SQL "inverse duplicates" query? - TechRepublic
General discussion
April 10, 2003 at 12:28 AM
mr. origami

SQL “inverse duplicates” query?

by mr. origami . Updated 23 years, 2 months ago

Anyone have any ideas for a “find inverse duplicates” query in Access? Here’s what I mean. I have one table – tblColors. Two fields – color1 and color2. Table tracks colors that look good together. So, someone may have:

Color1……..Color2
———————-
red………..orange
blue……….green
orange……..red

How do I weed out the duplicate red/orange pair? It’s not really a duplicate record, but kind of like an inverse duplicate.

I need the SQL syntax to display color1and color2 which in this case would return only 2 records – red/orange and blue/green. And it doesn’t matter if it returns red/orange or orange/red, as long as the pair is returned only once. So I’d run the query and get:

color1………..color2———————–
red…………..orange
blue………….green

This discussion is locked

All Comments