文章詳情頁
mysql - sql union 之后的結果與其他表join?
瀏覽:91日期: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. jquery - angularjs的數據為什么渲染不到頁面上?數據獲取到了,我的代碼哪里出了錯了?2. css - 如何控制鼠標事件?當處于down時會觸發其他效果,而up的時候則會取消所有效果?3. 求助一個Android控件名稱4. vim - docker中新的ubuntu12.04鏡像,運行vi提示,找不到命名.5. IOS app應用軟件的id號怎么查詢?比如百度貼吧的app-id=4779278136. javascript - 求助,html5如何調用攝像頭拍照??7. mysql數據庫是不是報10061錯誤8. python - flask的errorhandler(BaseError)重寫方法后怎么獲得更多信息9. css - 關于offsetLeft和offsetTop10. html5 - mui dialog 如何配置type屬性
排行榜
