how to select distinct value from multiple tables

前端 未结 2 936
-上瘾入骨i
-上瘾入骨i 2021-02-05 02:39

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

2条回答
  •  -上瘾入骨i
    2021-02-05 03:25

    SELECT city FROM A
    UNION DISTINCT
    SELECT city FROM B
    UNION DISTINCT
    SELECT city FROM C
    

提交回复
热议问题