--这只是一个例子 :)
declare @t table(id int)Insert into @t
select 1
union select 6
union select 2
union select 7
union select 3
union select 8
union select 4
union select 9
union select 5
union select 10select * from @t
order by case when id%5=0 then id else id%5 end,id/5
declare @t table(id int)Insert into @t
select 1
union select 6
union select 2
union select 7
union select 3
union select 8
union select 4
union select 9
union select 5
union select 10select * from @t
order by case when id%5=0 then id else id%5 end,id/5
求余 排序