SQL Syntax or Logic error?

MonsterMike

New member
Local time
Yesterday, 19:16
Joined
Aug 9, 2012
Messages
6
There are three columns (col_1, col_2, col_3) in one table that I would like to combine and remove duplicates. I am not getting the results I should be. My question is how would you do it? Do you see any errors? Here is what I've done (be warned, it's pretty ugly):

SELECT
.[col_1]
FROM

WHERE
.[col_1] <>
.[col_2]
UNION
SELECT
.[col_1]
FROM

WHERE
.[col_1] <>
.[col_3]
UNION
SELECT
.[col_2]
FROM

WHERE
.[col_2] <>
.[col_1]
UNION
SELECT
.[col_2]
FROM

WHERE
.[col_2] <>
.[col_3]
UNION
SELECT
.[col_3]
FROM

WHERE
.[col_3] <>
.[col_2]
UNION
SELECT
.[col_3]
FROM

WHERE
.[col_3] <>
.[col_1]
 
The wizard only appears to remove duplicate rows. I'm looking to remove duplicate records from the same row.
 
I feel like a real dummy!

This did the trick:

SELECT Table1.Email_1
FROM Table1
UNION
SELECT Table1.Email_2
FROM Table1
UNION
SELECT Table1.Email_3
FROM Table1;
 

Users who are viewing this thread

Back
Top Bottom