怎么将所查数据进行汇总成一行::

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

 

posted @ 2023-06-28 09:13  往事已成昨天  阅读(9)  评论(0编辑  收藏  举报