您可以在两个方向分配行号,然后在外部选择一个
order by:
select *from ( select row_number() over (order by SortColumn) rn1 , row_number() over (order by SortColumn) rn2 , * from @t ) as SubQueryAliasorder by case when @asc=1 then rn1 end, case when @asc=0 then rn2 end desc
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)