Hi,
I currently have 3 tables:
Table1
ID
Table2
ID
Table1_ID
Table3_ID
Table3
ID
Basically what I want to do is Join all three tables together.
I'm trying to do a:
SELECT Table3.*
FROM Table3 LEFT JOIN Table2 ON Table3.ID = Table2.Table3_ID JOIN Table1 ON Table2.Table1_ID = Table1.ID;
I can't get this to work and I've been looking around and I found:
---
FROM table1 join table2
ON table1.primarykey = table2.foreignkey join table3
ON table2.primarykey = table3.foreignkey
----
Does my query not work because I'm trying to use Table2's FK to join Table1's PK?
The site I found says I should do the reverse by joining Table2's PK to Table1's FK.
Basically what I'm trying to do is to list all items of table3, then join a few items in table2 and finally list a few items from table1 that matches up with table2.
Sorry if this is confusing but I haven't done this for awhile. THanks.
I currently have 3 tables:
Table1
ID
Table2
ID
Table1_ID
Table3_ID
Table3
ID
Basically what I want to do is Join all three tables together.
I'm trying to do a:
SELECT Table3.*
FROM Table3 LEFT JOIN Table2 ON Table3.ID = Table2.Table3_ID JOIN Table1 ON Table2.Table1_ID = Table1.ID;
I can't get this to work and I've been looking around and I found:
---
FROM table1 join table2
ON table1.primarykey = table2.foreignkey join table3
ON table2.primarykey = table3.foreignkey
----
Does my query not work because I'm trying to use Table2's FK to join Table1's PK?
The site I found says I should do the reverse by joining Table2's PK to Table1's FK.
Basically what I'm trying to do is to list all items of table3, then join a few items in table2 and finally list a few items from table1 that matches up with table2.
Sorry if this is confusing but I haven't done this for awhile. THanks.