|
Nov
21
|
-
If you use
GROUP BY, output rows are sorted according to theGROUP BYcolumns as if you had anORDER BYfor the same columns. To avoid the overhead of sorting thatGROUP BYproduces, addORDER BY NULL:SELECT a, COUNT(b) FROM test_table GROUP BY a ORDER BY NULL;
– 载自 MySQL 手册.
上面说的是, group by 默认会排序, 如果不想这么做, 必须显式声明.
Related posts:
Leave a Reply

Recent Comments