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 に答える