On Wed, Oct 08, 2008 at 01:36:37PM +0200, A. Kretschmer wrote: > test=*# select * from dup; > a | b > ---+--- > 1 | 1 > 1 | 2 > 2 | 1 > 1 | 1 > 3 | 3 > 3 | 3 > (6 rows) > > test=*# select * from dup where (ctid,a,b) not in (select distinct on (a,b) ctid,* from dup); > a | b > ---+--- > 1 | 1 > 3 | 3 > (2 rows) another approach: select a,b from dup group by a,b having count(*) > 1; depesz -- Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/ jid/gtalk: depesz@xxxxxxxxxx / aim:depeszhdl / skype:depesz_hdl / gg:6749007