SQL中运行 full outer join全连接报错是为什么

MySQL不支持 full outer join,如何做全连接(企业版可支持)

select s.camp_id,s.camp_name,k.read_flag from sony_push s full outer join `sony_push detail` k on s.camp_id=k.camp_id;

报错:

select s.camp_id,s.camp_name,k.read_flag from sony_push s full outer join `sony_push detail` k on s.camp_id=k.camp_id
> 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'full outer join `sony_push detail` k on s.camp_id=k.camp_id' at line 1
> 时间: 0s

普通的MySQL看来是不支持full outer join的了,可以这么处理:

select s.camp_id,s.camp_name,k.read_flag from sony_push s left join `sony_push detail` k on s.camp_id=k.camp_id union select s.camp_id,s.camp_name,k.read_flag from sony_push s right join `sony_push detail` k on s.camp_id=k.camp_id;

全部评论

相关推荐

头像
2025-12-27 13:01
三峡大学 C++
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务