简体   繁体   English

Ms sql server,选择查询显示overhand?

[英]Ms sql server , select query show overhand?

i want get query from 2 table but show all column overhand first all column from table 1 Second all column from table 2 then show overhand 我希望从2表中获取查询但是显示所有列首先从表1开始所有列然后表2中的所有列然后显示上手

table1
----------
a        1      2    3


table2
----------
b        4      5     6



query Result
----------
a        1       2     3
b        4       5     6

Grateful 感激

do you mean: 你的意思是:

Select * from table1
Union
Select * from table2

if you want all data no matter they are repetitive or not use UNION ALL otherwise if you want to have unique result use UNION 如果你想要所有数据,无论它们是重复的还是不使用UNION ALL否则如果你想拥有唯一的结果,请使用UNION

for example if you had 1 2 3 in table2 the result with UNION will be 例如,如果你在table2中有1 2 3,那么UNION的结果就是

1 2 3

and result with UNION ALL will be UNION ALL结果将是

1 2 3
1 2 3

Try using UNION in your query: 尝试在查询中使用UNION:

select * from table1
union all
select * from table2

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

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