热线电话:13121318867

登录
2019-03-11 阅读量: 1014
sql union 之后的结果与其他表join

问题描述:

sql1:

select id,name from table1;

sql2:

select id,name from table2;

union 合并表

select id,name from table1 
union
select id,name from table2;

如何将union合并后的结果变成一张新表再与其他表进行join?

解决方法:

select * from 
(select id,name from table1 union select id,name from table2) a
left join
(select id,name from table3) b on a.id = b.id;

0.0000
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子