views:

44

answers:

1

I have a 'guests' table and 'invitations' table bound with many-to-one relationship in a postgreSQL database. I have removed some guests and now I want to remove invitations that have no guests. I tried using 'COUNT', but aggregates are not allowed in WHERE clause.

+2  A: 

Check this :

delete from invitations where invitationid 
not in (select invitationid from guests)
Pranay Rana
Thanks. That worked. I wouldn't think about this.
zefciu