select s.name,c.classname,c.teacher from class c,student s where s.name = '小名' and c.classname = '___2%';
你的学滑迟生表好像不是信衡李ID来判别班级,而是class判别,数字是代表3年几班是吧?
表本身有问题,最佳是把学生表和班级表的class字段拦纳 froeign key。
select class.teacher ,
class.classname ,
class.renchu
from class,student
where class.id = student.class and
student.name = ?
select teacher,chassname,count(select * from student where class= 你旁滚要查的班芦橘级陪启团id ) from class