【发布时间】:2021-02-16 04:03:32
【问题描述】:
如何在 sql lite 中对多个表进行完全外连接? 不支持,但是有没有其他方法可以获得相同的结果?
【问题讨论】:
-
这能回答你的问题吗? FULL OUTER JOIN with SQLite
如何在 sql lite 中对多个表进行完全外连接? 不支持,但是有没有其他方法可以获得相同的结果?
【问题讨论】:
full join 的一般替换是:
select a.*, b.*. -- or whatever columns you want
from a left join
b
on <whatever>
union all
select a.*, b.*. -- same columns as above
from b left join
a
on <same whatever>
where a.id is null -- or some columns that represents a non-match
注意:这不使用union,因为这会删除重复项并且不等同于full join。
【讨论】: