Subject Re: using ALL or ANY
Author Rick Roen
Thanks Sven,

The nested "exists" DO work in 1.5.3.

I'm have not yet verified the results but I get a result set.

I can't follow the purpose of the second "not exists..."?

Rick

--- In firebird-support@yahoogroups.com, Svein Erling Tysvaer
<svein.erling.tysvaer@...> wrote:
>

> Hmm, this sounds unusual and requires some thinking.
>
> SELECT C.*
> from CUSTOMERS C
> where not exists(Select O.Season, SUM(O.Total) From ORDERS O
> where O.CUSTNUM = C.IDNUM Group by O.Season HAVING SUM(O.Total) <
1000)
> and not exists(select * from ORDERS O2
> where not exists(select * from ORDERS O3 where O3.CustNUM = C.IDNUM
> and O3.Season = O2.Season))
>
> Now, I've never tried using GROUP BY within a subselect and don't
know
> whether that works in Firebird 1.5 (I doubt it). The second not
exists
> (the one that is nested) should work and ensures that customers
with no
> orders in a season are eliminated from the result.
>
> Tell us whether this works, if not I think you have to
>