Subject | using ALL or ANY |
---|---|
Author | Rick Roen |
Post date | 2007-01-24T16:38:24Z |
FB 1.5.3
I need some SQL help.
I need to qualify customers that have sales of over 1000 in a "SEASON"
which is a field in the ORDERS table.
My simplified SQL:
Select C.*
from CUSTOMERS C
where 1000 > ALL(Select Sum(O.TOTAL) from ORDERS O where O.CUSTNUM =
C.IDNUM Group by O.SEASON)
but this is returning Customers that do not even have one sales, much
less all SEASON's sales over 1000.
Can someone shed some light on how to do this?
Rick
I need some SQL help.
I need to qualify customers that have sales of over 1000 in a "SEASON"
which is a field in the ORDERS table.
My simplified SQL:
Select C.*
from CUSTOMERS C
where 1000 > ALL(Select Sum(O.TOTAL) from ORDERS O where O.CUSTNUM =
C.IDNUM Group by O.SEASON)
but this is returning Customers that do not even have one sales, much
less all SEASON's sales over 1000.
Can someone shed some light on how to do this?
Rick