I would like to take two columns of data in the same table, and return the unique records from both in an ordered list. I tried this:
SELECT DISTINCT column1,column2 FROM table ORDER BY column1 ASC
However this obviously returns both columns, column2 has duplicates and its ordered by column 1.
I want to receive something like
Abcde [column1]
Beefr [column2]
Ceeed [column1]
Desss [column1]
...etc
Is this possible? I’m using PHP too if this helps?
You need to do a union
select distinct column1 v from table
union
select distinct column2 v from table
order by v