2014-04-23 47 views
0

我有两个表,两个表中都有列名'手机号'。我需要两个表中所有不同“手机号码”的结果集。什么是我的同样的查询。从两个不同的表中获得附加结果集的SQL查询

p.s:这是我的第一个问题,我也是sql查询的新手。对任何愚蠢的假设表示歉意,如果有的话。

+0

工作,你有一些查询,你试过吗? –

+0

[UNION](http://www.w3schools.com/sql/sql_union.asp)将会诀窍! – MinhD

+0

了解一下'UNION'。 –

回答

0

从两个表中选择使用union

select mobile_number from table_1 
union 
select mobile_number from table_2 

使用Union消除所有重复的结果,并只不同值。

0

这应该为你

select distinct(mobilenumber) 
from table 
union 
select distinct(mobilenumber) 
from table1; 
相关问题