一个表tableA某个字段num值为1,2,3,4,5
用什么sql语句排序可以让值为3的排在最上面,其他顺序不变比如 3,1,2,4,5?
select * from table where num =3 uniodn select * from table where num !=3
把uniodn改为union
哇,没听说有这种排序的方式,sql本身应该不提供这样的功能
select * from table where num =3 uniodn select * from table where num !=3
试过可以
select * from table order by case when num = 3 then -1 else num end