我想在case语句中返回多行。可能吗?或者有没有其他方法可以做到这一点?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。当子查询遵循=,!=,<,< =,>,> =或子查询被用作表达式时,这是不允许的。
其实我不想写多个查询。我想使用上面查询的resultset到另一个子查询。 – Abhi 2011-12-29 08:03:15
@Abhi:你不能以这种方式使用CASE,它只能返回**一个值**。如果你有可能返回多个值的子查询 - 你不能使用'CASE'来处理这个 – 2011-12-29 08:27:08