新手,
如何抽出同一【顾客番号】是5件以上的记录。

解决方案 »

  1.   

    select 顾客番号,count(*) from youtable group by 顾客番号 having with count(*)>=5
      

  2.   

    slect 的项目 我不想要count(*) ,只要顾客番号怎么做呢。?
      

  3.   

    那你就直接去掉count(*)呗。。
      

  4.   

    select 顾客番号,count(*) from youtable group by 顾客番号 having count(*)>=5
      

  5.   

    去掉count(*)好像就出错了吧。
      

  6.   

    别说好像错了就错了。。你试验了没?select 顾客番号 from (
       select 顾客番号,count(*) cn from youtable group by 顾客番号
    ) where cn >=5如果有错误你就用这个这总没问题了吧
      

  7.   

    楼主还真有些固执,选上了count(*),你可以不取它的值就可以了。有时候,也要兼顾到效率问题。
      

  8.   

    ora-00923:from keyword not found where expected。
    【select 顾客番号 from (】这个地方没看懂
      

  9.   

    嵌套的from,就把那个sql结果当成一个表就好了,报的错是找不到你的from,应该你拼写错误了吧
      

  10.   

    select *
    from tb a
    where (select count(*) from tb b where a.顾客番号=b.顾客番号)>=5
      

  11.   

    仅供参考select * from a where id (select id from a group by id having count(id)>5)