-2

as the title states, Let's say i have three tables: person, autos, numbers.

Created

First table with: INNER JOIN of person and autos

Second Table with: INNER JOIN of autos and numbers

Question: Is it possible to INNER JOIN first and second table ?

Roman
  • 61
  • 6

2 Answers2

1

You can join the two tables based on the autos part. Assuming it has an ID:

SELECT *
FROM   first_table f
JOIN   second_table s ON f.auto_id = s.auto_id
Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • The thing is, i do want to join it all together in one go, `first table` and `second table` was figurativly, it means i did first inner join along the lines of `Select * FROM "person" p INNER JOIN "autos" a on p."personID" = a."personID"` by doing this i created first table then i want to joint all this above with another collection of `inner join`'s that create the second table. Issue: since the table is only figuratevly, there should be some sort of anonymous way of `joining ` – Roman Oct 30 '20 at 13:47
1

You can do 2 joins (with 3 tables) together. Which are the keys for the joins? personID for person and autos and on numbers

SELECT *
FROM person p
JOIN autos a ON p.keyA= a.keyA
JOIN numbers n ON a.keyB = n.keyB

Where keyA and keyB are the corresponding field on which you want to do the join.

davide-pi
  • 310
  • 1
  • 9