作者:羊咩咩0_581 | 来源:互联网 | 2023-10-12 12:42
sql1:
1
| select id,name from table1; |
sql2:
1
| select id,name from table2; |
union 合并表
1 2 3
| select id,name from table1
union
select id,name from table2; |
如何将union合并后的结果变成一张新表再与其他表进行join
如:
1 2 3 4
| 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; |