I need to get distinct values from 3 tables.
When I perform this code:
select DISTINCT(city) from a,b,c
I get an error which says that
The UNION keyword will return unique
records on the result list. When specifying ALL
(UNION ALL) will keep duplicates on the result set, which the OP don't want.
SELECT city FROM tableA
UNION
SELECT city FROM tableB
UNION
SELECT city FROM tableC
RESULT
╔════════╗
║ CITY ║
╠════════╣
║ Krakow ║
║ Paris ║
║ Rome ║
║ London ║
║ Oslo ║
╚════════╝
SELECT city FROM A
UNION DISTINCT
SELECT city FROM B
UNION DISTINCT
SELECT city FROM C