MonsterMike
New member
- Local time
- Yesterday, 17:55
- 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]
SELECT
FROM
WHERE
UNION
SELECT
FROM
WHERE
UNION
SELECT
FROM
WHERE
UNION
SELECT
FROM
WHERE
UNION
SELECT
FROM
WHERE
UNION
SELECT
FROM
WHERE