[英]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.