First half is delete from pref_scores where gid in (select gid from pref_scores where id=_id); but how to clean pref_games? -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general