MYSQL目前常用的两种方法,如下:

 

让值为"张三" 的数据排在最前.

-- 方法一
select * from tableName  ORDER BY  case when columnName='张三' then 0  else 1 end  asc


-- 方法二
select * from tableName  where columnName ='张三' union all select * from tableName  where columnName <>'张三'

 

相关文章:

  • 2021-07-02
  • 2021-07-02
  • 2022-12-23
  • 2021-07-20
  • 2021-09-17
  • 2021-07-05
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案