+----+---------+
| id | name |
+----+---------+
| 1 | David |
| 2 | Roz |
| 3 | Patrick |
| 4 | Chris |
| 5 | Agnes |
| 6 | Freya |
+----+---------+
结果如何首先记录我的选择。
例如:我选择roz是第一个
+----+---------+
| id | name |
+----+---------+
| 2 | Roz |
| 1 | David |
| 3 | Patrick |
| 4 | Chris |
| 5 | Agnes |
| 6 | Freya |
+----+---------+
或者我选择第一个agnes
+----+---------+
| id | name |
+----+---------+
| 5 | Agnes |
| 1 | David |
| 2 | Roz |
| 3 | Patrick |
| 4 | Chris |
| 6 | Freya |
+----+---------+
答案 0 :(得分:2)
这样的东西,你的具体名称,然后是其余的默认排序
SELECT *
FROM `FOO`
ORDER BY (`name` = 'Roz') DESC, `name`