2016-01-30 64 views

回答

2

使用UNION

select id, name, email, phone 
from table1 

union 

select id, name, email, phone 
from table2 

union 

select id, name, email, phone 
from table3; 

在上述查询相同的行不同表将被呈现为一列。如果你想要所有表中的所有行使用UNION ALL。

使用相交的所有三个表中只选择相同的行:

select id, name, email, phone 
from table1 

intersect 

select id, name, email, phone 
from table2 

intersect 

select id, name, email, phone 
from table3; 
相关问题