sql 怎么得到group by 后每个组内数据的条数

2024-12-05 02:20:10
推荐回答(3个)
回答1:

select id, count(*)
from tab
group by id

count(*)就是你id组对应的条数

回答2:

假如表 test 字段 a, b;按照a分组
select a,count(*) 条数
from test
group by a

回答3:

group by xx
having count(*)>=n