Subject | Re: SQL for master-detail |
---|---|
Author | Dan Cooperstock |
Post date | 2007-12-27T17:57:16Z |
--- In firebird-support@yahoogroups.com, "Ed Dressel" <Dressel@...>
wrote:
Select * from MasterInfo m
where
(select count(*)
from DetailInfo d
where m.Master_ID = d.Master_ID) <= 1
wrote:
>Sure:
> I am looking for all of the master records that have one or no detail
> records.
>
> Select Master_ID from MasterInfo where Master_ID (select Master_ID
> from DetailInfo where [less then one record])
>
> Can this be done without a stored proc?
Select * from MasterInfo m
where
(select count(*)
from DetailInfo d
where m.Master_ID = d.Master_ID) <= 1