作者fantasywater (狂想)
看板Database
标题[SQL ] HAVING语法一问
时间Sun Feb 3 00:50:43 2008
语法:select salary,count(*) from employee group by salary;
结果:
+--------+----------+
| salary | count(*) |
+--------+----------+
| 25000 | 3 |
| 30000 | 1 |
| 38000 | 1 |
| 40000 | 1 |
| 43000 | 1 |
| 55000 | 1 |
+--------+----------+
问题:我想请问的是 如果我只要count(*)最大的那一笔
having後面要怎麽写
我用max和top是半天都没有结果,下面才是我要的结果
+--------+----------+
| salary | count(*) |
+--------+----------+
| 25000 | 3 |
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.228.35.183
1F:→ fantasywater:mysql + limit 1 就是了 02/03 01:18
2F:推 gargamel:自问自答???呵...用不着having就是了... 02/03 23:05
3F:→ fantasywater:因为自己研究出来了XD 02/04 02:55