Khrys
Khrys

Reputation: 2774

Select distinct from Muiltiple columns into one column

I have this:

ColumnA    ColumnB    ColumnC
Dog        Soda       Book
CatIce     Juice      Notebook      
Bird       Water      Pencil
Dog        Water      Notebook

By using this select:

select ColumnA, ColumnB, ColumnC from table     

I wanna a list like this:

ColumnD
Bird
Book
Cat
Dog
Ice
Juice
Notebook      
Pencil
Soda
Water

How can I do this? Thanks!

Upvotes: 1

Views: 100

Answers (1)

Jake1164
Jake1164

Reputation: 12349

Use a UNION

SELECT ColumnA
FROM table

UNION

SELECT ColumnB
FROM table

UNION

SELECT columnC
FROM table

Upvotes: 2

Related Questions