开发者

Filter on count(*) in oracle

开发者 https://www.devze.com 2023-01-01 04:37 出处:网络
I have a grouped query, and would like to filter it based on count(*) Can I do this without a subquery?

I have a grouped query, and would like to filter it based on count(*)

Can I do this without a subquery?

This is what I have currently:

select * 
  from (select ID,
               开发者_如何学Pythoncount(*) cnt
          from name
      group by ID)
 where cnt > 1;


what you are looking for is the HAVING clause:

select ID, count(*) cnt
from name
group by ID
having count(*) > 1;
0

精彩评论

暂无评论...
验证码 换一张
取 消