Filter on count(*) in oracle
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;
精彩评论