将table1中id 为2的记录置顶
select * from table1
order by case when id='2' then 0 else 1 end

例子:将已发布的置顶,status  0:未发布 1:已发布 2:已下架

select ID,NO_DEMAND,NAME_UNIT,WEIGHT_PLAN,TIME_ENABLE,TIME_CREATE,CREATER,COMMENT
 ,case STATUS when '0' then '未发布' when '1' then '已发布' when '2' then '下架' end as  STATUS 
 ,case FEEDBACK when '0' then '未确认接收' when '1' then '已确认接收' when '2' then '已确认不接收' end as  FEEDBACK 
 from bus_demand  where valid='1'order by case when status='1' then 0 else 1 end

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2021-05-18
猜你喜欢
  • 2022-01-01
  • 2021-05-05
  • 2021-11-21
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2021-05-27
相关资源
相似解决方案