mysqlkumao 发表于 2008-2-11 16:00:23

group by 居然有 order by 效果

今天才知道 group by 居然有 order by 效果,也可以用 asc 和 desc 关键字

mysql> select * from abc;

+----+------+
| c1 | c2   |
+----+------+
|1 |5.2 |
|2 |2.5 |
|3 |7.8 |
|4 | 5.69 |
|5 | 4.05 |
+----+------+
5 rows in set (0.00 sec)

mysql> select * from abc group by c2;

+----+------+
| c1 | c2   |
+----+------+
|2 |2.5 |
|5 | 4.05 |
|1 |5.2 |
|4 | 5.69 |
|3 |7.8 |
+----+------+
5 rows in set (0.00 sec)

[ 本帖最后由 mysqlkumao 于 2008-2-11 17:06 编辑 ]
页: [1]
查看完整版本: group by 居然有 order by 效果