繁体   English   中英

SQL将未关联数据表中的两个字段放入同一字段?

[英]SQL Two fields from tables of unassociated data into the same field?

我正在尝试使用SQL:

-------------------------------
Table A
-------------------------------
ID | Title
1  | Something Groovy
2  | Something Else

-------------------------------
Table B
-------------------------------
ID | Title
1  | Something Different
2  | Something More

精选声明

-------------------------------
Both in one field
-------------------------------
Title
Something Groovy
Something Else
Something Different
Something More

有任何想法吗?

使用UNION ALL获得两个选择的并集。 如果要消除重复项,只需使用UNION

SELECT Title FROM TableA
UNION ALL
SELECT Title FROM TableB

这是一个简单的联合:

Select title from TableA

UNION

Select title from TableB

请注意,所有相同的项目都将被删除。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM