Received: from shell.mpsi.net (shell.mpsi.net [207.252.220.24]) by hub.org (8.8.8/8.7.5) with ESMTP id KAA07005 for ; Sat, 16 May 1998 10:10:07 -0400 (EDT) Received: from localhost (alewis@localhost) by shell.mpsi.net (8.8.6/8.8.6.Beta3) with SMTP id OAA15135; Sat, 16 May 1998 14:10:06 GMT Date: Sat, 16 May 1998 09:10:06 -0500 (CDT) From: Andy Lewis To: phd2@earthling.net cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] Duplicate rows In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Thanks, I'll give it a try. Andy On Sat, 16 May 1998, Oleg Broytmann wrote: >Hi! > >On Sat, 16 May 1998, Andy Lewis wrote: >> Right, I know that there are dups in the column. But, I don't know where they >> are nor do I know their value(s). I want to be able to find, say, two interger >> values that are in the same column but, different rows. > > It seems that you need a correlated subquery - a loop for every row, that >tests whether there are equal values. > >SELECT oid, mycolumn FROM mytable a > WHERE mycolumn IN > (SELECT oid, mycolumn FROM mytable b > WHERE a.oid <> b.oid) > >Or may be, join with the same table. Not sure what is better in this >situation. > >SELECT oid, mycolumn FROM mytable a, mytable b > WHERE a.oid <> b.oid AND > a.mycolumn = b.mycolumn > > In both cases "a.oid <> b.oid" excludes the same row from comparison (I >am pretty sure that in the same row a.mycolumn = b.column :). > >Oleg. >---- > Oleg Broytmann http://members..tripod.com/~phd2/ phd2@earthling.net > Programmers don't die, they just GOSUB without RETURN. > >