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
                   2010-06-04 08:08:04
                
              Thanks. That worked. I wouldn't think about this.
                  zefciu
                   2010-06-04 08:34:34