I have a large table with data that is not unique but needs to be. This table is a result of multiple union selects so is not an actual table. I cannot make it an actual table for other reasons.
All of the UNION'd tables have an email column which will eventually be unique. The resulting records look like this:
1 ozzy@test.com Ozzy
2 test@test.com Tony
3 test@yahoo.com Steve
4 tiny@test.com
13 tony@gmail.com Tony
14 test@test.com Ozzy
15 test@yahoo.com Dave
16 tiny@test.com Tim
As you can see, some emails appear more then once with different names or non existent names. When I add a GROUP BY email clause at the end, the results look like this:
1 ozzy@test.com Ozzy
2 test@test.com Tony
3 test@yahoo.com Steve
4 tiny@test.com