with the tables same multiple left itself inner sql sqlite join full-outer-join

the - FULL OUTER JOIN con SQLite



sqlite merge tables (2)

SQLite solo tiene INNER e LEFT JOIN.

¿Hay alguna forma de hacer un FULL OUTER JOIN con SQLite?


Sí, mira el ejemplo en 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


Siguiendo el comentario de Jonathan Leffler, aquí hay una respuesta alternativa a la de 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

Consulte here fuente original y otros ejemplos de SQLite.