【发布时间】:2013-04-24 09:21:41
【问题描述】:
因此,我问了一个关于如何摆脱#temp 表的问题。
How to get rid of #temp tables
也得到了解决.. 但我也不想使用 CTE。
任何想法,如何将所有这些查询合并为一个。
select {some columns} into #temp1 from {some tables} where {conditions1}
select {some other columns} into #temp2 from {some tables} where {conditions2}
select {some other columns} into #temp3 from {some tables} where {conditions3}
select {some columns from all #temp tables} from #temp1, #temp2,
#temp3 where {conditions}
谢谢
杰
【问题讨论】:
-
如果没有表格脚本、所需列、WHERE 和 JOIN 条件,我们真的无能为力
-
@gbn,完全同意......但我不能在这里发布我的查询。谢谢
-
其实我已经解决了……但我也遇到了一些其他的异常。
标签: sql-server-2005 left-join common-table-expression