首页 > 代码库 > mysql实现full join

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 的合一块去了. 所以出现了重复内容

mysql实现full join