Databases Querying Relational Databases Joining Table Data with SQL JOIN Queries

Shreemangal Sethi
Shreemangal Sethi
Full Stack JavaScript Techdegree Student 7,506 Points

INNER JOIN 3 Table and Multiple Columns.

There are 3 tables and Multiple Columns i am not sure how to use INNER JOIN twice after FROM keyword.

2 Answers

Sean T. Unwin
MOD
Sean T. Unwin
Treehouse Moderator 28,388 Points

Here's a pseudo-code example:

SELECT
T1.field1
T2.field2
T3.field3
FROM T1
INNER JOIN T2 ON (T1.someId = T2.someId)
INNER JOIN T3 ON (T2.someOtherId = T3.someOtherId) 
-- The second JOIN could also match T1.someId if the same column is in T3