mysql實現full join


呵呵,,,有個坑,,mysql默認不支持full join 是吧. 什么是full join呢就是left+right join  可以使用union聯表解決這個問題
union 鏈接 http://www.php20.com/forum.php?m ... &extra=page%3D1
原表鏈接 http://www.php20.com/forum.php?m ... &extra=page%3D1咱們的鏈接如下

[SQL] 純文本查看 復制代碼
?
1
2
3
select b.title,b.content,a.class_name,a.id as classid from news_class as a left join news as b on a.id=b.id
union all  
select b.title,b.content,a.class_name,a.id as classid from news_class as a right join news as b on a.id=b.id;



結果right和left 的合一塊去了. 所以出現了重復內容


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM