文章详情页
mysql - sql union 之后的结果与其他表join?
浏览:76日期:2022-06-15 16:59:37
问题描述
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) aleft join (select id,name from table3) b on a.id = b.id;
问题解答
回答1:可以尝试下临时表、表变量;你最后这个应该也可以吧
相关文章:
排行榜
