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
 General SQL Server Forums
 New to SQL Server Programming
 tryig to join three tables

Author  Topic 

luis1010
Starting Member

5 Posts

Posted - 2007-12-02 : 15:54:17
I am trying to join three tables 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 can't seem to find the error and it is driving me nuts. Can someone please help?

Thanks,
Luis

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-12-02 : 16:05:52
Tried take out inner from first join?
Go to Top of Page

luis1010
Starting Member

5 Posts

Posted - 2007-12-02 : 16:30:43
I did:

SELECT *
FROM tbl_RegistrationInfo r 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

and now i get a new syntax error:

'syntax error in FROM clause'

Thanks,
Luis
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-02 : 19:20:34
Your query looks fine. Is this on Microsoft SQL Server ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

luis1010
Starting Member

5 Posts

Posted - 2007-12-03 : 09:48:42
it is a query being done on data in access
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-12-03 : 11:07:56
>> it is a query being done on data in access

This is a SQL Server forum. You should post your questions regarding Access in the MS Access forum.

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

- Advertisement -