I have
country
, theOrderColumn1
country
, theOrderColumn2
I want to join DISTINCT country
from these two SELECT statements:
SELECT DISTINCT `country` FROM `table1` ORDER BY `theOrderColumn1`
and
SELECT DISTINCT `country` FROM `table2` ORDER BY `theOrderColumn2`
Example:
table1 (country, theOrderColumn1): (uk, 1), (usa, 2)
table2 (country, theOrderColumn2): (france, 1), (uk, 2)
I want this result:
france
uk
usa
select distinct country
from (
select country, theOrderColumn from table1
union all
select country, theOrderColumn from table2
) a
order by theOrderColumn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With