0

如何将此 SQL 片段生成为临时表,以便将其他内容加入其中?

with MyCTE AS
(
    select *, RANK() OVER (PARTITION BY workplace ORDER BY Total DESC) AS Rank
    from [dbo].[OriginDestination]
)
select * from MyCTE where Rank <= 5
4

1 回答 1

3

像这样:

with MyCTE AS
(
    select *, RANK() OVER (PARTITION BY workplace ORDER BY Total DESC) AS Rank
    from [dbo].[OriginDestination]
)
select *
into #yourTempTable 
from MyCTE 
where Rank <= 5
于 2012-10-09T21:22:11.753 回答