1

In using the following Query (based on Microsoft SQL format guides, as I am new to Access, though experienced with SQL) I get an error:

SELECT SW.USGS_NO, Q.SampleDate
FROM SW_PROPERTIES SW 
Inner Join (Locations L 
Inner join [(]Sample_Point P [
Inner Join [(]T_TestEvents E [
Inner Join [(]T_WQData Q )]
on E.TestEvent=Q.TestEvent)]
on P.SamplePnt=E.SamplePnt)]
on L.LocationPnt=P.LocationPnt)
on SW.SiteID=L.LocationPnt

The error is simply:

"Syntax error in FROM clause."

After closing the error, the renaming, or final, 'P' in "[(]SamplePoint P [" is highlighted.

I know the links between tables are valid, and I just want the data from the highest and lowest tables. What am I missing?

2
  • What do you mean by "data from highest and lowest tables"? Commented Apr 3, 2013 at 17:20
  • If I am drilling down through the tables, I only am really looking for data from the first and the last. Not from the tables in between that I have to link through. Commented Apr 3, 2013 at 17:31

2 Answers 2

1

Try this

SELECT SW.USGS_NO, Q.SampleDate
FROM ((([SW_PROPERTIES] SW 
Inner Join ([Locations] L 
Inner join [Sample_Point] P 
Inner Join [T_TestEvents] E 
Inner Join [T_WQData] Q
on E.TestEvent=Q.TestEvent)
on P.SamplePnt=E.SamplePnt)
on L.LocationPnt=P.LocationPnt)
on SW.SiteID=L.LocationPnt
Sign up to request clarification or add additional context in comments.

Comments

0

What is the significance of the square brackets?

I removed them, and since you're just using INNER JOIN, you don't even need parenthesis. Try this:

SELECT 
    SW.USGS_NO, 
    Q.SampleDate

FROM SW_PROPERTIES SW 
Inner Join Locations L 
    on SW.SiteID=L.LocationPnt
Inner join Sample_Point P
    on L.LocationPnt=P.LocationPnt
Inner Join T_TestEvents E
    on P.SamplePnt=E.SamplePnt
Inner Join T_WQData Q 
    on E.TestEvent=Q.TestEvent

2 Comments

Yeah, the reason I had to go on the Microsoft website to look up their SQL syntax was that I was getting errors using it that way. That is how I originally had it set up, but that gives a missing operator error. Apparently, MS likes all the brackets and parenthesis. Removing the brackets from the open paren. gives a Join syntax error, highlighting the last two Inner Joins. Removing all brackets seems to run, but asks for a Parameter Value for E.TestEvent. I'm not sure where it is getting the command to ask for a parameter...
Access will always prompt for a parameter for an unrecognised fieldname. I find that Access usually requires brackets with multiple joins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.