MS Access中的SQL查询生成语法错误

时间:2013-04-24 10:10:00

标签: mysql sql ms-access

我在MSAccess中遇到问题。代码如下所示:

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#;

该数据库是为虚构的健身房创建的。

查询的目的是显示锻炼计划成员所处的日期,其出生日期大于01/01/83。查询选择的信息来自3个表。客户,TrainingProgram和WorkOutPlan。另一个表'Registration'将Customer Table和Training Program表与'CustomerId'

链接在一起

查询产生语法错误并突出显示括号'“(”INNER JOIN WorkOutPlan))'。我无法看到代码的任何问题,但也许我一路上犯了错误?

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

正确支架

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#;