SQLite只有INNER和LEFT JOIN.
有没有办法与SQLite进行完全外连接?
是的,请参阅Wikipedia上的示例.
SELECT employee.*, department.* FROM employee LEFT JOIN department ON employee.DepartmentID = department.DepartmentID UNION ALL SELECT employee.*, department.* FROM department LEFT JOIN employee ON employee.DepartmentID = department.DepartmentID WHERE employee.DepartmentID IS NULL
在乔纳森·莱夫勒(Jonathan Leffler)评论之后,这是马克·拜尔斯(Mark Byers)的另一种答案:
SELECT * FROM table_name_1 LEFT OUTER JOIN table_name_2 ON id_1 = id_2 UNION SELECT * FROM table_name_2 LEFT OUTER JOIN table_name_1 ON id_1 = id_2
请参阅此处以获取原始源代码和其他SQLite示例。