Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query MS Access using SQL 1

Status
Not open for further replies.

AGus01

Technical User
Sep 6, 2005
54
GB
Hi can anyone advise why I get an error running this query:
I get an error saying Syntax mistake by the keyword FROM.
If i remove the 2nd Right Join the query runs?

Code:
select 
cou.name,
cou.details,
cou.startdate,
cou.venue
from tblCourses as cou
Right Join tblCourseAttendees as ca ON  cou.courseid = ca.courseid 
Right Join tblContacts as con ON ca.contactid = con.Contactid
 Where cou.courseid=2

My SQL skills are a bit rusty so any help appreciated.
thanks for your time.
 
You appear to be missing some brackets.

Code:
select 
cou.name,
cou.details,
cou.startdate,
cou.venue
from (tblCourses as cou
Right Join tblCourseAttendees as ca ON  cou.courseid = ca.courseid)  
Right Join tblContacts as con ON ca.contactid = con.Contactid
 Where cou.courseid=2
 
Hi Ramou,

thanks for getting back to me. That was a great help. So you need to use parenthesis in MS Access.

can you confirm to me if I was to add a third table to the query i would the syntax as follows:

Code:
select
cou.name,
cou.details,
cou.startdate,
cou.venue
from ((tblCourses as cou
Right Join tblCourseAttendees as ca ON  cou.courseid = ca.courseid)  
Right Join tblContacts as con ON ca.contactid = con.Contactid)
Right Join tblName as t ON  t.tableid = con.tableid 
 Where cou.courseid=2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top