We use GROUP_CONCAT function to concatenate multiple rows into one column.
SELECT dept_id, GROUP_CONCAT (DISTINCT dept_name SEPERATOR ', ') AS department FROM employees GROUP BY dept_id;
Coderraj is the global online platform and circle for programmers to learn, communicate, share their knowledge and growth their careers.
Copyright ©2022 coderraj.com. All Rights Reserved.