Subject RE: [firebird-support] Re: SQL for master-detail
Author Leyne, Sean
> > >>> 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.

It seems that Ed's original post was confusing. I focused on:

> Select Master_ID from MasterInfo where Master_ID (select Master_ID
> from DetailInfo where [less then one record])

"[less then one record]" is 0 records, which is NOT EXISTS.


So it would seem that we were both correct, it depends on which part of
the message you read or replied to. ;-)


Sean