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;

在这里插入图片描述

©️2020 CSDN 皮肤主题: 酷酷鲨 设计师:CSDN官方博客 返回首页