select sc.StudentID as 学号,st.username as 学生姓名, co.courseName as 科目名称,sc.CourseID as 科目ID from score as sc
left join student as st on
(sc.studentID=st.StudentId)
left join course as co on
(sc.CourseID=co.courseID)
--对相应的数据进行分组计算
group by sc.CourseID,sc.StudentID,st.username,co.courseName
--having 分组过后的数据
having count(sc.CourseID)>=2
全部不懂还是那个地方不明天,
score表与student 表根据sc.studentID=st.StudentId进行连接之后再与course 表根据sc.CourseID=co.courseID进行连接,
关于连接的你可以看看这里http://www.sufeinet.com/thread-51-1-1.html
连接表之后取这些字段select sc.StudentID as 学号,st.username as 学生姓名, co.courseName as 科目名称,sc.CourseID as 科目ID from score as sc
as是重命名字段
对相应的数据进行分组计算
group by sc.CourseID,sc.StudentID,st.username,co.courseName
--having 分组过后的数据
having count(sc.CourseID)>=2
这两个不说了吧,上面有注释