【发布时间】:2011-12-29 07:46:15
【问题描述】:
我想在 case 语句中返回多行。是否可以?还是有其他方法可以做到这一点?
select
case
when 3 = 1
then (select orderid from order_master where noOfInstallment = installmentPaid)
else
(select orderid from order_master where noOfInstallment <> installmentPaid)
END
两个子查询都返回多行。现在上面的查询显示以下错误。
子查询返回超过 1 个值。当子查询跟随 =、!=、、>= 或使用子查询时,这是不允许的 作为表达式。
【问题讨论】:
标签: sql-server subquery case-statement