Find duplicates between different fields

P

Pfrogs

Hi,

I want to perform a query to find duplicates in between different fields.
For example, this being my database:

Field1 Field2
------ ------
aa zz
bb DDD
cc xx
DDD yy
ee vv

What I want is the query to show the following result:

Field1 Field2
------ ------
bb DDD
DDD yy

cause the record "DDD" in Field1 also appears in Field2 (Note that it
also appears in a different row)

How can I perform such query?
I tryed to adapt the query from "Find duplicates" wizard with no luck.
If someone could help me with some SQL code, I would appreciate.


Pfrogs
 
M

MGFoster

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

Perhaps this:

select field1, field2
from table1
where field2 in (select field1 from table1)
or field1 in (select field2 from table1)

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkSDIIechKqOuFEgEQLWEgCg5JcWVjnjF78Kvn2h7S8gA2QobCwAniFj
XZ4Qwri49WSncDWbDdcinFjA
=at9Y
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top