Query to show technicians and associated groups_PGSQL

Query to show technicians and associated groups_PGSQL

SELECT AaaUser.FIRST_NAME "Technician Name",
(sdo.NAME) "Associated Site",
array_to_string(array_agg(distinct(qd.queuename)), ',') "Associated Group" FROM AaaUser 
left JOIN SDUser ON AaaUser.USER_ID=SDUser.USERID 
inner JOIN HelpDeskCrew ON SDUser.USERID=HelpDeskCrew.TECHNICIANID 
LEFT JOIN AaaLogin ON AaaUser.USER_ID=AaaLogin.USER_ID 
LEFT JOIN Queue_Technician qt on qt.TECHNICIANID=AaaUser.USER_ID 
LEFT JOIN QueueDefinition qd ON qt.QUEUEID=qd.QUEUEID 
LEFT JOIN SDOrganization sdo ON qd.SITEID=sdo.ORG_ID
WHERE (SDUser.STATUS = 'ACTIVE') group by AaaUser.FIRST_NAME,SDO.NAME 
order by 1


PGSQL