From: Andy Lewis <alewis@mpsi.net>
To: phd2@earthling.net
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Duplicate rows
Date: Sat, 16 May 1998 09:10:06 -0500 (CDT)
Message-ID: <Pine.LNX.3.95.980516090952.15079C-100000@shell.mpsi.net> (raw)
In-Reply-To: <Pine.LNX.3.96.SK.980516175721.21932B-100000@torus.comus.ru>
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.
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: alewis@mpsi.net, phd2@earthling.net
Subject: Re: [SQL] Duplicate rows
In-Reply-To: <Pine.LNX.3.95.980516090952.15079C-100000@shell.mpsi.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox