--
DECLARE @Score TABLE([Name] NVARCHAR(30), [Score] INT); INSERT INTO @Score VALUES ('John', 100); INSERT INTO @Score VALUES ('Mary', 100); INSERT INTO @Score VALUES ('Bob', 96); INSERT INTO @Score VALUES ('Peter', 96); INSERT INTO @Score VALUES ('Cindy', 95); SELECT Name AS '姓名', Score AS '成績', RANK() OVER (ORDER BY Score DESC) AS '名次'FROM @Score;
沒有留言:
張貼留言