Alexander Farber wrote: delete from pref_users where id not in (select distinct id from pref_money); Hi, try instead delete from pref_users where id in (select id from pref_users except select id from pref_money); Regards Wolfgang Hamann -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general