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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inner join problem - 3 tables

Status
Not open for further replies.

aliashippysmom

Programmer
Jul 29, 2004
43
0
0
US
I haven't used Access in quite a while and am trying to join 3 tables. I'm getting syntax errors. I have tried doing the query with no table aliases, adding parens where I think they need to go. MS says to do all the INNER JOIN clauses first, still no go. Here is the query:
Code:
SELECT * FROM Groups 
INNER JOIN (Member_Group  ON Member_Group.groupID = groups.ID)
INNER JOIN (Members  ON members.ID = member_Group.membershipID) 
WHERE m.ID = 1948

I am getting (now) a syntax error in the JOIN clause.

Does anyone have any ideas? I've stared at this for the past hour or so [sad]

Thanks in advance!
 
hi,

Are you coding this or using the interactive query grid in MS Access query?

If the former, then why not the latter?

If the latter, then I can't see why you would get an error.

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks for your reply. I am coding this myself and not using the query grid (not sure what that is). I inherited a bunch of ASP code and am making some changes. Would the query grid help identify the error?
 



Not unless you're in MS Access...
[tt]
SELECT *

FROM
Groups
, Member_Group
, Members

Where Member_Group.groupID = groups.ID
AND members.ID = member_Group.membershipID
AND [red]m[/red].ID = 1948
[/tt]
maybe...
[tt]
SELECT *

FROM
Groups
, Member_Group
, Members

Where Member_Group.groupID = groups.ID
AND members.ID = member_Group.membershipID
AND groups.ID = 1948
[/tt]
????



Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks. I've downloaded the database and am able to use MS Access 7 to open and display the data. I've tried to use the Query building options, but that's not really what I need. I just need someway to run this query as I have it written using their interface. Is this a pass-thru query? I just need a screen where I can copy and paste what I have.

Thanks again.
 
What about this ?
Code:
SELECT * FROM (Groups G 
INNER JOIN Member_Group MG ON G.groupID = MG.ID)
INNER JOIN Members M ON MG.membershipID = M.ID
WHERE M.ID = 1948

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yea, that's better. But now I get "invalid use of null". Is that because it doesn't find a record in one of the join tables?
 
I get "invalid use of null"
What is YOUR whole actual SQL code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top