开发者

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;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜