文章详情页
mysql - sql union 之后的结果与其他表join?
浏览:113日期: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:可以尝试下临时表、表变量;你最后这个应该也可以吧
相关文章:
1. pdo_mysql 值自增写法2. Mysql取下一条记录3. mysql-配置 - MySQL错误,时不时自动挂掉,无法启动4. angular.js - 如何在指令里使用ng-click5. android 文件File删除问题6. angular.js - angularJS ng-show的显示问题7. angular.js - angularjs实现点击事件后,在firefox生效却在360浏览器不起作用8. PHP中的$this代表当前的类还是方法?9. mysql 怎么做到update只更新一行数据?10. 求救一下,用新版的phpstudy,数据库过段时间会消失是什么情况?
排行榜

网公网安备