Solved

double inner join

Posted on 2004-10-11
14
567 Views
Last Modified: 2010-05-18
Hi,
I am trying to run this query but i am getting a syntax error. Help Please. thanks

SELECT [Member#],[LastName],[FirstName],[Email] FROM tblMembers INNER JOIN tblEvent ON tblMembers.MemberID = tblEvent.MemberID INNER JOIN tblAvail ON tblMembers.MemberID = tblAvail.MemberID WHERE tblAvail.Days=-1 AND tblEvent.EventSingles=-1
0
Comment
Question by:aannan
  • 5
  • 4
  • 3
  • +1
14 Comments
 
LVL 5

Expert Comment

by:broesi
Comment Utility
Hi,

what exactly does the error message say?

broesi
0
 
LVL 8

Assisted Solution

by:Jupiler78
Jupiler78 earned 25 total points
Comment Utility
Hi aannan,

What says the error? You could try this

SELECT [Member#],[LastName],[FirstName],[Email] FROM tblMembers INNER JOIN tblEvent ON [tblMembers].MemberID = [tblEvent].MemberID INNER JOIN tblAvail ON [tblMembers].MemberID = [tblAvail].MemberID WHERE [tblAvail].Days=-1 AND [tblEvent].EventSingles=-1


Cheers!
0
 

Expert Comment

by:Mamine
Comment Utility
Try putting the first join in brackets:

SELECT [Member#],[LastName],[FirstName],[Email] FROM (tblMembers INNER JOIN tblEvent ON tblMembers.MemberID = tblEvent.MemberID) INNER JOIN tblAvail ON tblMembers.MemberID = tblAvail.MemberID WHERE tblAvail.Days=-1 AND tblEvent.EventSingles=-1
0
 

Author Comment

by:aannan
Comment Utility
error says its a syntax error and there is a missing operator.
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
Have you tried the solution I put here and the one Mamine put here?
0
 

Author Comment

by:aannan
Comment Utility
I have tried both still getting the same error.
0
 

Expert Comment

by:Mamine
Comment Utility
Have you got the semi-colon at the end of the statement ?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Expert Comment

by:Mamine
Comment Utility
Have you checked all the column names are correct ? It sounds like there maybe another error here rather than the join being the problem
0
 
LVL 5

Expert Comment

by:broesi
Comment Utility
My guess is that the # is the problem. Try to rename the field in the table if possible (or create a copy of that table, change the column name there and try the query with the new table).

broesi
0
 

Author Comment

by:aannan
Comment Utility
Yep have semi-colon at the end. Do you think it has anything to do because I am running  the query in the SQL builder in access? the query looks fine to me unless theres is some detail i am missing
0
 

Accepted Solution

by:
Mamine earned 25 total points
Comment Utility
Should be fine in SQL builder buut is always worth trying to display in Design mode too - that way it will show up any syntax errors before you try to run the query. If you can't display it in Design mode then try re-entering the query in Design mode a step at a time.
0
 

Author Comment

by:aannan
Comment Utility
Found it! Added a few more brackets and changed some names. Thanks
0
 

Expert Comment

by:Mamine
Comment Utility
Hehe glad you got it working :)
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
Glad I've been of a help to you
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now