我有下表。我需要从我的寄存器表中获取有StudentID&的记录。类ID,到证书表。我不知道如何做到这一点,我对此有正确的查询或关系!
Tables:
Certificates(StudentID, ClassID, CertificateID, Mark)
Student(StudentID, FirstNameFA, LastNameFA)
Registers(RegisterID, StudentID, ClassID)
Classes(ClassID, LessonType)
我试过了:
SELECT Registers.StudentID
,Students.NationalityCode
,Registers.ClassID
,Students.FirstNameFA
,Students.LastNameFA
,Students.FirstNameEN
,Students.LastNameEN
,Certificates.Grade
,Certificates.Issued
,Certificates.CertificateID
,([FirstNameFA] + " " + [LastNameFA]) AS FullNameFA
,([Sex] + " " + [FirstNameEN] + " " + [LastNameEN]) AS FullNameEN
FROM Classes
INNER JOIN Students
LEFT JOIN Certificates ON Students.StudentID = Certificates.StudentID
INNER JOIN Registers ON Students.StudentID = Registers.StudentID
ON Classes.ClassID = Registers.ClassID
WHERE Registers.ClassID IS NOT NULL
AND Registers.ClassID = [Forms] ! [Class Report] ! [cbClass];
我仍然无法在我的证书表格中添加此查询中的任何记录。我需要在每个有班级的学生的证书表中加上标记。