如何组合两个表 [英] How to combine two tables

查看:58
本文介绍了如何组合两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两张桌子(Tabel 1,Tabel2)

表1(在表格的selct语句之后我得到以下两列)

I am having two tables (Tabel 1,Tabel2)
Table 1(After selct statement of the table i am getting these two below columns)

Column1|column2|
xx     |yy     |
zz     |AA     |
BB     |cc     |

Tabel 2(After selct statement of the table i am getting these two below columns)
<pre lang="xml">Column1|Column2|
DD     |FF     |
GG     |HH     |

i need the combination of two tables should be like below
Table 3

&lt;pre lang=&quot;vb&quot;&gt;Column !|Column 2|
xx     |yy     |
zz     |AA     |
BB     |cc     |
DD     |FF     |
GG     |HH     |&lt;/pre&gt;</pre>

推荐答案

您可以使用SQL:UNION ALL [ ^ ]也是如此。试试这个:

You can use SQL: UNION ALL[^] to do the same. Try this:
SELECT Column1, Column2 FROM Table1
UNION ALL
SELECT YourCol1 AS Column1, YourCol2 AS Column2 FROM Table2





--Amit



--Amit


使用union如下所示< br $>


Use union as shown below

Select column1,column2 from table1 [where CONDITION]
UNION ALL
Select column1,column2 from table2 [where CONDITION]


这篇关于如何组合两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆