Thread: SQL query question
Hi all, I have 2 tables, with a 1-n relation: parent( oid, parent_name) child(oid, child_name, iod_parent) How do I get the parent_names of all parents without a child? TIA Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl
> Hi all, > > I have 2 tables, with a 1-n relation: > > parent( oid, parent_name) > child(oid, child_name, iod_parent) > > How do I get the parent_names of all parents without a child? select parent_name from parent left join child on (parent.oid=child.iod_parent) where child.oid is null; or select parent_name from parent where not exists (select * from child where child.iod_parent=parent.oid); Regards, Tomasz Myrta