MySQL order by 简单解析
1. 语句
SELECT distinct first_letter
FROM tb_customer
WHERE (deleted = 0) ORDER BY first_letter = '#' asc,first_letter;
2. 个人理解
order by first_letter = '#' 相当于做了一个判断 first_letter == "#" ? 1 : 0;
3. SQL完整写法
SELECT distinct first_letter
FROM tb_customer
WHERE (deleted = 0) ORDER BY if(first_letter = '#',1,0) asc,first_letter asc;
4. 结果
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。