select a,c from tb,
(select a from tb group by a having count(*)>7) t
where tb.a=t.a;

解决方案 »

  1.   

    我的环境是IBM P660 + Oracle81740,表太大了有三百多万条记录,我原来也是用你的方法,查了半个多小时没出结果,只有中断了.请问各位有没有更优化的SQL呀???
      

  2.   

    select  a  from  tb  group  by  a  having  count(*)  >7
    执行这一句需要多长时间?
      

  3.   

    我原来的方法就像这样:
    select a,c from table
    where a in (select a from table
    group by a
    having count(*) > 7);
      

  4.   

    select tb.a,tb.c from tb,
    (select a from tb group by a having count(a)>7) t
    where tb.a=t.a;