select * from table where CUSTMER in (select CUSTMER from table group by CUSTMER where sum(PRICE)>0)

解决方案 »

  1.   

    SELECT * FROM CUSTMER a
    WHERE a.NAME IN (SELECT NAME FROM CUSTMER
                     GROUP BY NAME
                     HAVING SUM(PRICE)<>0)
      

  2.   

    select * from tablename a
    where a.customer in (
    select customer from tablename
    group by customer
    having sum(price) <> 0
    )
      

  3.   

    select * from table as A where 
     (select sum(PRICE) from yourtable where CUSTMER = A.CUSTMER) >0
      

  4.   

    SELECT * FROM CUSTMER a
    WHERE a.NAME IN (SELECT NAME FROM CUSTMER GROUP BY NAME HAVING SUM(PRICE)<>0)