有一种方法可以返回依赖于该字段的子选择和返回操作吗?
例如,我可以这样做:
select a, (select top 1 b from b) as b, (a * b) as c
from a
答案 0 :(得分:2)
select a, b, (a * b) as c
from (
select a, (select top 1 b from b) as b
from a
) x
答案 1 :(得分:0)
将子查询放在from
子句中:
select a.a, b.b, (a.a * b.b) as c
from a cross join
(select top 1 b from b) b;