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 <>'张三'
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 <>'张三'
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。