Reputation: 77
Let's say I have 3 tables and I want to join them like this:
table 1 join table 2 and table 2 join table 3
I'm trying the following code but I'm getting an error of syntax.
SELECT * from table1 join table2 and table2 join table3
on table1.id=table2.idA and table2.idB=table3.id
Upvotes: 0
Views: 2440
Reputation: 1269743
Study up a bit on SQL. The syntax looks like:
select *
from table1 join
table2
on table1.id = table2.idA join
table3
on table2.idB = table3.id;
This is very basic JOIN
syntax and should be covered in any tutorial, documentation, book, paper or whatever that you are using to learn SQL.
Upvotes: 2