Nevermind, sorry - I've figured it out myself (for a change) delete from pref_scores where id<>_id and gid in (select gid from pref_scores where id=_id); delete from pref_games where gid in (select gid from pref_scores where id=_id); delete from pref_scores where id=_id; Regards Alex -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general