表连接在sql中

时间:2017-04-14 10:15:10

标签: sql

我有一张表admin

id  name   college      selection   download
---------------------------------------------
1   kriti      bv          admin    BC
2   priyanka   bv          admin    BC 

和另一个表guide

id  name     college   selection
---------------------------------
3   namrata   bv       anil

我想得到这个结果:

id   name     college   selection
---------------------------------
1    kriti     bv        admin
2    priyanka  bv        admin
3    namrata   bv        anil

请建议SQL查询

1 个答案:

答案 0 :(得分:2)

如果您需要输出,请使用UNION ALL,就像您说的那样

select id , name , college , selection from admin
UNION ALL
select id , name , college , selection from guide