1

I'm having trouble with a query in MSAccess. The code is shown below:

SELECT CustomerId, FirstName, Surname, DateOfBirth, WorkoutId, Name, Description
   FROM Customer 
   INNER JOIN (Registration INNER JOIN TrainingProgram (INNER JOIN WorkOutPlan)) 
   ON Customer.CustomerId = Registration.CustomerId 
   ON Registration.CustomerId = TrainingProgram.CustomerId 
   ON TrainingProgram.WorkId = WorkOutPlan.WorkId
      WHERE DateOfBirth > #01/01/83#;

The database has been created for a fictional gym.

The aim of the query is to show what workout plan members are on with a date of birth greater that 01/01/83. The information the query is selecting is coming from 3 Tables. Customer, TrainingProgram and WorkOutPlan. The other table 'Registration' links the Customer Table and Training Program table with 'CustomerId'

The query is producing a syntax error and highlighting the bracket '"("INNER JOIN WorkOutPlan))'. I cant see any issues with the code but maybe I have made a mistake along the way?

Your help would be much appreciated.

1 Answer 1

3

Bracket properly

SELECT CustomerId, FirstName, Surname, DateOfBirth, WorkoutId, Name, Description
FROM (Customer 
INNER JOIN (Registration
            INNER JOIN (TrainingProgram
                        INNER JOIN WorkOutPlan 
                                   ON Customer.CustomerId = Registration.CustomerId )
                        ON Registration.CustomerId = TrainingProgram.CustomerId )
            ON TrainingProgram.WorkId = WorkOutPlan.WorkId)
WHERE DateOfBirth > #01/01/83#;
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your reply! I really appreciate it! I'm still receiving a Syntax Error. Its saying its in the Join Operation and highlighting just customer from -> 'SELECT "Customer"Id,' . Iv played around with it a bit but again cant seem to find any problems

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.