日期:2014-05-17 浏览次数:20435 次
select name,count(student.id) times from teacher left join student on teacher.id=student.teacherId; group by teacher.name--少了
------解决方案--------------------
;with cte_temp as ( select teacherId,COUNT(1) as times ) select a.name,b.times from teacher a left join cte_temp b on a.id = b.teacherId