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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to