我正在处理 SQL 查询。我有以下表格
Class
(ID,Name
)Competition
(ID,Name
)Month
(ID,Name
)Student
(ID,Name,Class,MonthEnrollment
)
所有这些表都已在表中引用
Competition_Result(ID,Class,Competiton,Month,First,Second,Third)
First, Second 和是 students_ID。为了获得第 1 个月的比赛结果,我使用了以下 sql 查询:
SELECT
Competitions.Name AS Comp, Students.Name AS Student,
Class.Name AS ClassName, Competition_Result.*
FROM Competition_Result
INNER JOINCompetitions ON Competition_Result.Competition = Competitions.ID
INNER JOIN Students ON Competition_Result.First = Students.ID AND Competition_Result.Second = Students.ID AND Competition_Result.Third = Students.ID
INNER JOIN Class ON Competition_Result.Class = Class.ID
但它不起作用..请帮助我