Mysql
 sql >> Datenbank >  >> RDS >> Mysql

mysql - Gruppe, aber alle Zeilen einer Spalte anzeigen

Verwenden Sie GROUP_CONCAT

SELECT  staff.name,
        staff.designation_id_designation,
        staff.status_id_status,
        GROUP_CONCAT(Concat_Ws('=', leave_remain.leave_type_id_leave_type, leave_remain.days)) AS remain
FROM    staff 
        INNER JOIN leave_remain 
            ON staff.id_staff = leave_remain.staff_id_staff
GROUP   BY staff.name, staff.designation_id_designation, staff.status_id_status  

andere Links