标签: mysql sql
如果需要ORDER BY FIELD_id DESC,,如何在Mysql中执行订单,但第一行必须是FIELD_id = 5行
ORDER BY FIELD_id DESC,
FIELD_id = 5
答案 0 :(得分:4)
您可以使用条件排序:
ORDER BY Field_id = 5 DESC, field_id DESC
SQL Fiddle Demo
答案 1 :(得分:0)
你应该从申请中做到,或者你可以做联合
SELECT field_id, ... FROM table WHERE field_id = 5 UNION SELECT field_id, ... FROM table WHERE field_id != 5 ORDER BY field_id