sql遍历全部数据集

DECLARE @a int
set @a = 1
while @a < 5
BEGIN
select top(1) * from QPShuGameMatchDB..MatchScoreStatistics
where UserID in 
(
select top (@a) UserID from QPShuGameMatchDB..MatchScoreStatistics order by Score desc 
)
order by Score;
set @a = @a + 1
END

原文地址:https://www.cnblogs.com/mthoutai/p/6747417.html