-3
我想創建下面的語句的看法:創建一個視圖,其中包括高管
declare @tab1 varchar(20);
declare @tab2 varchar(20);
declare @tab3 varchar(20);
select @tab1 = tablet from result where RANK = 1;
select @tab2 = tablet from result where RANK = 2;
select @tab3 = tablet from result where RANK = 3;
exec('
SELECT [1] AS '[email protected]+', [2] AS '[email protected]+', [3] AS '[email protected]+'
FROM (SELECT RANK, time, row_number() OVER (partition BY koy
ORDER BY time ASC) AS ranking
FROM result) s
PIVOT (max(time) FOR rank IN ([1], [2], [3])) p');
什麼似乎是這個問題?你不誠實地期待我們猜測..? – sagi
可能重複的[在SQL中動態更改列名稱](http://stackoverflow.com/questions/16185425/change-columns-name-dynamically-in-sql) – Lucero
請谷歌和了解有關CREATE VIEW語句及其限制。 –