我正在寻找可以返回与两个给定查询相同结果的查询:
select foo as res1 from table t where t.id in (1,2)
select foo as res2 from table t where t.id in (3,4)
我需要类似的东西:
select
(select foo from table t where t.id in (1,2)) as res1,
(select foo from table t where t.id in (3,4)) as res2
但我得到的只是错误:
子查询返回超过 1 个值
我需要的结果:
资源1 | 资源2 |
---|---|
foo1 | foo3 |
foo2 | foo4 |
如何仅使用一个查询获得这样的结果?