MySQL 指定内容排到最前面

SELECT *, `zhangsan` = 3 AS `zhangsan_key` FROM `zhangsan_db` ORDER BY `zhangsan_key` DESC;

SELECT * FROM `zhangsan_db` ORDER BY `zhangsan` = 3 DESC;

数据表中zhangsan字段的值等于3的会排到前面

你可能感兴趣的:(MySQL,mysql,数据库)