首页 > TAG信息列表 > cllx
left join 和 group by 一起使用
--1 s 连接 s2 ,如果s表要写group by 就得用括号,因为s left join s2 是一张表只能有一个group by ,所以括号抱起来 SELECT s.coun1,s2.coun2 FROM (SELECT ssex,count() coun1 FROM student group by ssex)s LEFT JOIN (select ssex,count() coun2 from student where sname='赵雷'