SQLite Forum

Join Multiple Table

Join Multiple Table

(1) By Bsy (Bshuyi) on 2021-07-09 07:34:20 [link] [source]

How to join multiple table as below example:

Table_1 LEFT JOIN Table_2 ON TABLE_1.Condition = TABLE_2.Condition

Table_2 LEFT JOIN Table_3 ON TABLE_2.Condition = TABLE_3.Condition

The 3 table have to join together to show result.

How should I query?

(2) By Kees Nuyt (knu) on 2021-07-09 12:03:42 in reply to 1 [source]

SELECT col1,col2,..
     FROM Table_1 AS T1
LEFT JOIN Table_2 AS T2 ON T2.col2 = T1.col1
LEFT JOIN Table_3 AS T3 ON T3.col4 = T2.col3
LEFT JOIN Table_4 AS T4 ON T4.col5 = T1.col6
 WHERE ....
 ORDER BY ....