Subject Re: SQL for master-detail
Author Dan Cooperstock
--- In firebird-support@yahoogroups.com, Gabor Boros <gaborboros@...>
wrote:
>
> Hi,
>
> NOT EXIST is not a good solution for the problem.
>
>
> Gabor
>
> >>> I am looking for all of the master records that have one or no
detail

NOT EXISTS would be a good solution if the original request was to find
all Master records that have no associated Detail records. But the
actual request was to find all Master records that have either 0 or 1
detail records. That's why my solution is correct and the NOT EXISTS
solution is not correct.