Subject | RE: [firebird-support] Re: SQL for master-detail |
---|---|
Author | Leyne, Sean |
Post date | 2007-12-27T19:30:54Z |
> > >>> I am looking for all of the master records that have one or nofind
> detail
>
> NOT EXISTS would be a good solution if the original request was to
> all Master records that have no associated Detail records. But theIt seems that Ed's original post was confusing. I focused on:
> actual request was to find all Master records that have either 0 or 1
> detail records.
> Select Master_ID from MasterInfo where Master_ID (select Master_ID"[less then one record]" is 0 records, which is NOT EXISTS.
> from DetailInfo where [less then one record])
So it would seem that we were both correct, it depends on which part of
the message you read or replied to. ;-)
Sean