http://expert.csdn.net/Expert/topic/2636/2636859.xml?temp=2.915591E-02

解决方案 »

  1.   

    select productno,resid,dosagedetail from demanddetail
    group by productno,resid,dosagedetail
    having cound(*)>1
      

  2.   


    select * 
    from demanddetail 
    group by productno,resid,dosagedetail 
    having count(*)>1
      

  3.   

    select * from demanddetail a
    where exists(select productno,resid,dosagedetail from demanddetail b
      where a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail
      group by productno,resid,dosagedetail having count(*)>1)
      

  4.   


    select a.*
    from demanddetail a join(
    select productno,resid,dosagedetail
    from demanddetail
    group by productno,resid,dosagedetail
    having count(*)>1
    )b on a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail
      

  5.   

    搞得复杂了,简单点:
    select * from demanddetail a
    where (select count(*) from demanddetail b
      where a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail)>1