2011-02-19 50 views
0
StudentProfile 
-studentid 

Registration 
-registrationid 
-studentid(foreign key to StudentProfile) 

RegistrationSchedule 
-regscheduleid(is not a primary key,, is not unique,,can have a lot of instances) 
-registrationdid(foreign key to registration) 
-scheduleid 

Schedules 
-scheduleid 

請記住,有在時間表表 心中已經試過內沒有regscheduleid加入他們所有,但只對結果大作 我怎樣才能拿到學生展望爲多個結果

的所有日程安排
+0

請向我們展示您正在使用的SQL語句。 – 2011-02-19 01:51:49

+0

你可以顯示你試過的查詢,你認爲應該工作嗎? – jswolf19 2011-02-19 01:54:28

回答

0

這將爲您提供從學生檔案到計劃詳細信息的所有信息。

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 

刪除查詢中不需要的表。

如果要篩選特定學生,請添加WHERE t.studentid = 1234