yxt
yxt

Reputation: 17

How do I get distinct count values of 2 columns?

Lets say I have 2 columns, a and b.

Column A contains these values:

a
b
c
d

Column B contains these values:

e
d
c
b
a

What can I do to get the absolute distinct values from BOTH columns?

Meaning if i want to have a count on both columns, the result is to be 5. Because a, b, c and d are repeated in column B but not e.

Upvotes: 1

Views: 75

Answers (1)

Yosi Dahari
Yosi Dahari

Reputation: 6999

SELECT A
FROM YourTable
UNION
SELECT B
FROM YourTable

Upvotes: 3

Related Questions