select s.name,s.dept_name
from department d
left outer join student s
on d.dept_name=s.dept_name
order by building;
SELECT s.dept_name,GROUP_CONCAT(s.name SEPARATOR ',') name
from department d
left outer join student s
on d.dept_name=s.dept_name
GROUP BY s.dept_name
标签:GROUP,name,所查,汇总,一行,dept,student,outer From: https://www.cnblogs.com/cherishthepresent/p/17510482.html