dreampolice
Technical User
My Access 2000 query works great in the below with the left join on TableThree.
It fetches the data and also gets the status for TableTwo using the INNER JOIN:
INNER JOIN Status as myStatus on myTableTwo.status_id = myStatus.status_id
I now need to get status using the TableThree status_id if I have data in TableThree, and need to get it from the Status table.
My attempt is not working:
Here are my 4 Tables:
TableOne
tableOne_id PK
TableTwo
tableTwo_id PK
tableOne_id FK
status_id
TableThree
tableThree_id PK
tableTwo_id FK
tableOne_id FK
status_id
Status
status_id PK
status
PK=Primary Key
FK=Foreign Key
Please advise.
It fetches the data and also gets the status for TableTwo using the INNER JOIN:
INNER JOIN Status as myStatus on myTableTwo.status_id = myStatus.status_id
Code:
SELECT *
FROM ((TableTwo AS myTableTwo
INNER JOIN TableOne AS myTableOne
ON myTableTwo.tableOne_id = myTableOne.tableOne_id)
INNER JOIN Status as myStatus on myTableTwo.status_id = myStatus.status_id)
LEFT JOIN TableThree as myTableThree on myTableTwo.tableTwo_id = myTableThree.tableTwo_id
WHERE myTableOne.tableOne_id = 3;
I now need to get status using the TableThree status_id if I have data in TableThree, and need to get it from the Status table.
My attempt is not working:
Code:
SELECT *
FROM ((TableTwo AS myTableTwo
INNER JOIN TableOne AS myTableOne
ON myTableTwo.tableOne_id = myTableOne.tableOne_id)
INNER JOIN Status as myStatus on myTableTwo.status_id = myStatus.status_id)
LEFT JOIN TableThree as myTableThree on myTableTwo.tableTwo_id = myTableThree.tableTwo_id
[COLOR=green](INNER JOIN myTableThree.status_id = myStatus.status_id)[/color]
WHERE myTableOne.tableOne_id = 3;
Here are my 4 Tables:
TableOne
tableOne_id PK
TableTwo
tableTwo_id PK
tableOne_id FK
status_id
TableThree
tableThree_id PK
tableTwo_id FK
tableOne_id FK
status_id
Status
status_id PK
status
PK=Primary Key
FK=Foreign Key
Please advise.