我要检索两张表,一个学生信息表StudentInfo,一张学生课堂成绩统计表,现在我要查找所有学生信息及成绩情况,所以我想到有左连接select * from studentinfo left join lessonscore on studentinfo.studentid=lessonscore.studentid and lessonid=1OK,到这没有问题,但是我现在只想检索特定年级的学生信息,然后再连接对应的成绩表信息,比如5年级所以我这样写:select * from studentinfo where grade=5 left join lessonscore on studentinfo.studentid=lessonscore.studentid and lessonid=1就提示 在关键字 'left' 附近有语法错误。哪位高手指教一下,应该怎么写,才能实现我的要求呢
where 应写在后面!!
studentinfo.studentid in(select * from studentinfo where grade=5)