max max - 1 year ago 107
SQL Question

triple join using sqlite

Let's say we have 3 tables:

table1: firstname, id

table2: id, lastname

table3: lastname, height

and we want to display: firstname, height

I'd likely use full join for that:

select firstname, height from
(select firstname, lastname ln from table1
full join table2 on
full join table3 on ln=table3.lastname

but in sqlite, full and right joins do not exist and I need to some how use union to get it.
Any ideas, how to do it?

Answer Source


SELECT firstname, height
FROM table1 INNER JOIN table2 ON
            INNER JOIN table3 ON table2.lastname=table3.lastname