-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Disclaimer: I'm not an SQL expert so please don't laugh. ;-)

I'm trying to generate a way to find all rows from a table where the data in 
column 'foo' is a duplicate of the data in another row.

I.E.:

row | foo
1   | a
2   | c
3   | b
4   | c
5   | a
6   | d

the statement would return me rows 1, 2, 4, and 5.

I tried this:
SELECT t1.* FROM mytable AS t1, mytable AS t2 WHERE t1.foo = t2.foo && 
t1.rownum != t2.rownum ;

It works on my test table with 10 records, but takes a really long time on my 
table with a large number (13000) of records.

The numerical column is the primary key, and the other column is indexed.

Is there a way to speed this up, or do it more efficiently?

Thanks,
Simon

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAH4LxyEdVKI+MVc8RAiYJAJsFdfGHbkk7RRRIXm8V+fIN28OB2QCfWbbE
bWgRa2AkYlDB0mbQP3GHIMc=
=AWOE
-----END PGP SIGNATURE-----


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to