22,209
社区成员
发帖
与我相关
我的任务
分享
select top 4 * from tb
order by (case when cityID>=2001 then city else 2001*2-city end)
select top 4 * from 表A
order by (case when cityID=2001 then 0 else 1 end)
select top 4 *
from tab
order by case when cityid = 2001 then 0 else 1 end,newid()
select top 4 * from tb order by case when cityID= 2001 then 0 else 1 end
select top 4 * from tb order by case when cityID=2001 then 0 else 1 end
select top 4 *
from tab
order by case when cityid = 2001 then 0 else 1 end,id
用存储过程+while循环来做吧,因为你这个涉及到插入多条的问题