SQL获取一列中的两列记录
SQL to get two column records in one column
我有两个 table,都包含字段 telephone_number
。我想从 table 中找到所有 distinct/unique 的电话号码。这能做到吗?
例如
Table A
telephone_number
123
123
345
Table B
telephone_number
1234
123
678
Output Table
123
345
678
1234
谢谢
抱歉格式化
如果您希望两个表中的电话号码不同,请使用 union
:
select telephone_number
from t1
union -- on purpose to remove duplicates
select telephone_number
from t2;
我有两个 table,都包含字段 telephone_number
。我想从 table 中找到所有 distinct/unique 的电话号码。这能做到吗?
例如
Table A
telephone_number
123
123
345
Table B
telephone_number
1234
123
678
Output Table
123
345
678
1234
谢谢
抱歉格式化
如果您希望两个表中的电话号码不同,请使用 union
:
select telephone_number
from t1
union -- on purpose to remove duplicates
select telephone_number
from t2;