方法如下:
select * from <表名> order by case when <条件> then 1 else 0 end asc

举例:
把threads表中列id值小于100的放到最后(也就是说>=100的在前面,但是顺序是不确定的,同时<100的在后面,顺序也是不确定的)
select * from threads order by case when id<100 then 1 else 0 end asc
出来的结果可能是:
id date
109 100809
110 100810
99 100812
76 100813
其中109和110谁在前面的不确定的, 99和76谁在前面也是不确定的

相关文章:

  • 2022-01-04
  • 2021-10-15
  • 2021-12-31
  • 2021-08-07
  • 2021-12-08
  • 2021-11-27
猜你喜欢
  • 2022-01-03
  • 2021-12-04
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-11-23
  • 2021-08-28
相关资源
相似解决方案