我有以下结构:
Create @temp
Select ...inser...into @temp where ...
(select ... from @temp
Join tblA where ... )
UNION
(Select ... from @temp
join tblB where ... )
在建立上表之后,我需要能够执行 WHERE、JOINS、...
就像是:
Select ... from (above statement)
join ....
where....
我不知道 @temp,joins, union... 是否可以在其他选择中。
或者我唯一能做的就是创建一个带有第一个语句结果的@Temp2 插入,然后与其他连接一起工作,在哪里......?
更新 1:
我也在尝试:
With cte (query returned columns)
as
(same query I was using to build my @temp as before)
(select ... from cte
join tblA
where...)
UNION
(select ... from cte
join tblB
where...)
但是我在如何执行其他连接方面停留在同一点上,其中......总结果高于