Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 three table join

Author  Topic 

luis1010
Starting Member

5 Posts

Posted - 2007-12-03 : 11:46:22
I am trying to join three tables in Access and I keep getting a syntax error:

syntax error in query expression r.intRegID = i.intRegID JOIN tbl_Categories c on i.intCategoryID=c.intCategoryID

The full query is:

SELECT *
from tbl_RegistrationInfo r INNER JOIN tbl_Ideas i
on r.intRegID = i.intRegID JOIN tbl_Categories c
on i.intCategoryID=c.intCategoryID
where i.intIdeaID=4
ORDER BY i.DateCreated

THe common key for the tables tbl_RegistrationInfo and tbl_Ideas is intRegID.
THe common key for the tables tbl_Ideas and tbl_Categories is intCategoryID.
And finally the user provides a value for the "idea" (i.intIdeaID=4).

I tried :

SELECT *
from tbl_RegistrationInfo r INNER JOIN tbl_Ideas i
on r.intRegID = i.intRegID JOIN tbl_Categories c
on i.intCategoryID=c.intCategoryID
where i.intIdeaID=4
ORDER BY i.DateCreated

I get a 'syntax error in from clause'

I can't seem to find the error and it is driving me nuts. Can someone please help?

luis1010
Starting Member

5 Posts

Posted - 2007-12-03 : 12:44:03
here is a screen shot of the tables

http://www.heidisplayhouse.com/tables.gif
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-12-03 : 14:22:27
In Access, you need to use parenthesis in your join clauses, you cannot just list them out one after another like you can in T-SQL. Try using the Access query designer to do the join first, and then check out the SQL it generates.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -