Database error - RIGHT and FULL OUTER JOINs are not currently supported
Asked Answered
M

3

11

I was trying to RIGHT JOIN two tables using this query:

SELECT Persons.firstname, company.lastname
FROM Persons
RIGHT JOIN company ON Persons.firstname=company.firstname;

which comes with this error:

RIGHT and FULL OUTER JOINs are not currently supported

How can we get rid of this?

Note: I am using Mozilla DB manager.

Marry answered 8/8, 2017 at 11:0 Comment(1)
Does this answer your question? FULL OUTER JOIN with SQLiteGangland
M
24

By doing a left join and switching the tables

SELECT Persons.firstname, company.lastname
FROM company
LEFT JOIN Persons ON Persons.firstname = company.firstname;
Mccartney answered 8/8, 2017 at 11:2 Comment(0)
S
9

For FULL OUTER JOIN UNION the result of LEFT and RIGHT( again swapped LEFT JOIN) JOIN results...

 SELECT Persons.firstname,company.lastname FROM Persons LEFT JOIN company ON 
 Persons.firstname=company.firstname
 union 
 SELECT Persons.firstname, company.lastname FROM company LEFT JOIN Persons ON 
 Persons.firstname=company.firstname;
Stratagem answered 26/10, 2018 at 12:54 Comment(1)
I think you need UNION ALL instead of UNION as explained in Sqlite FULL OUTER JOIN emulation.Eminent
P
1

Actually, I think you can either:

  1. Do exactly as Siddappa posted

OR

  1. Use UNION ALL and add WHERE Persons.firstname IS NULL to the second select statement. If you only do the UNION ALL without the null check, you can get duplicate rows in the result.

I think #2 is probably more efficient.

Phyllys answered 2/4, 2021 at 15:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.