标签:each 表名 mysql sel group by teacher 报错 left join error
select student_id,student.sname FROM score LEFT JOIN student on student_id=student.sid where course_id in(
select cid from course LEFT JOIN teacher on course.teacher_id=teacher.tid where teacher.tname=‘李平老师‘
) GROUP BY student_id -- LEFT JOIN必须在from 表名的后面 若放在 where 后面 或group 后面 将报错,如下:
select student_id,student.sname FROM score where course_id in(
select cid from course LEFT JOIN teacher on course.teacher_id=teacher.tid where teacher.tname=‘李平老师‘
) LEFT JOIN student on student_id=student.sid GROUP BY student_id --error
select student_id,student.sname FROM score where course_id in(
select cid from course LEFT JOIN teacher on course.teacher_id=teacher.tid where teacher.tname=‘李平老师‘
)GROUP BY student_id LEFT JOIN student on student_id=student.sid --error
标签:each 表名 mysql sel group by teacher 报错 left join error
原文地址:http://www.cnblogs.com/whigo/p/7687988.html