我在以下子查询内部选择了两个。我想划分(subquery1 / subquery2)两个子查询。你是怎么做到的?
Select subquery1/subquery2,subquery1,subquery2 From.....
...谢谢
答案 0 :(得分:2)
如果你有SQL Server 2005或更高版本,你可以这样做
select
SQ.s1 / SQ.s2, SQ.s1, SQ.s2
from table as t
outer apply (select subquery1 as s1, subquery2 as s2) as SQ
如果你有SQL 2000,那么你可以使用子查询:)
select
SQ.s1 / SQ.s2, SQ.s1, SQ.s2
from
(
select subquery1 as s1, subquery2 as s2
from table as t
) as SQ