mysql小问题,求大佬解答

select *
from (select id, sum(degree)
from employee_skill
group by id
)as t1 full outer join
(select id, sum(score)
from project_employee
group by id
)as t2
where t1.id = t2.id

这段 sql 语句 不知道为什么 不能使用 全外连接,如果是内连接的话,语句是没有问题的
希望大佬能解答一下

mysql 是不支持全外连接的,可以使用union all进行替换

应该是数据库本身的规定

用JOIN 一样的效果,换个方式把

mysql不支持全外连接,试着用以下,left join + right join union 替换 full outer join
SELECT * FROM t1
LEFT JOIN t2 ON t1.id = t2.id
UNION
SELECT * FROM t1
RIGHT JOIN t2 ON t1.id = t2.id

select *
from (select id, sum(degree)
from employee_skill 
group by id
)as t1
UNION ALL
(select id, sum(score)
from project_employee
group by id
)as t2
where t1.id = t2.id

你这个mysql不支持全外连接,你可以用这个,left join + right join union 来替换 full outer join

outer join则会返回每个满足第一个(顶端)输入与第二个(底端)输入的联接的行。它还返回任何在第二个输入中没有匹配行的第一个输入中的行。
通常我们省略outer 这个关键字。写成:LEFT/RIGHT/FULL JOIN。

select *
from (select id, sum(degree)
from employee_skill
group by id
)as t1 full join
(select id, sum(score)
from project_employee
group by id
)as t2
where t1.id = t2.id

试试关键词用法