oracle中的group by的问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 08:07:01
select count(id),name from XTable group by name
结果是 count(id) name
1 aa
1 ac
2 ab
1 ad
2 ap
1 az
1 aq
1 ax
其中的count(id)是什么意思?为什么有2的?
就是有重复的id吗?

这边count(id)和count(*)是等价的...
是说你group by 后,name相同的数据有2个...
不是说id相同...

就是name是aa的有一条
name是ab的有两条
count就是统计条数的函数

统计同一名字有多少ID