Oh ok, found it: # select one.username, one.user_id, two.user_id from phpbb_users one, phpbb_users two where two.username=one.username and two.user_id <> one.user_id; username | user_id | user_id ----------+---------+--------- Вячеслав | 7564 | 421 Вячеслав | 421 | 7564 (2 rows) Sorry! -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general