如何连接4个表并检索有关一个ID(行)的信息?

这是我到目前为止的内容:

最佳答案

尝试这样的事情。

SELECT  Student.Student_ID, Course.Crs_Desc,
    Enrollment.Std_ID, Enrollment.Offer_No,
    Offering.Offer_No
    FROM Student
        JOIN Enrollment
            ON Student.Student_ID = Enrollment.Std_ID
        JOIN Offering
            ON Enrollment.Std_ID = Offering.Offer_No
        JOIN Course
            ON Offering.Offer_No = Course.CourseNo
        WHERE Student_ID = '103';


同样,WHERE子句看起来可能是错误的。尝试“ WHERE Student_ID ='103';”

关于mysql - 用SQL连接四个表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26737676/

10-10 00:52