开发者

Looking up for multiple results

StudentProfile
-studentid

Registration
-registrationid
-studentid(foreign key to StudentProfile)

RegistrationSchedule
-regscheduleid(is not a primary key,, is not unique,,can have a lot of ins开发者_JS百科tances)
-registrationdid(foreign key to registration)
-scheduleid

Schedules
-scheduleid

please keep in mind that there is no regscheduleid in schedules table i'v tried inner joining them all but only on result comes up how can i get all the schedules of that student


This will get you all the information, from student's profile, to schedule details.

SELECT t.StudentID, s.ScheduleID
FROM StudentProfile t JOIN Registration r
    ON t.studentid = r.studentid
  JOIN RegistrationSchedule rs 
    ON r.registrationid = rs.registrationdid
  JOIN Schedules s ON rs.scheduleid = s.scheduleid

Remove the tables you do not need in the query.

If you want to filter for a specific student, add WHERE t.studentid = 1234.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜