I have the following MySQL query.
SELECT h.hostname
, c.name
, d.cim_item
, t.datastatus
, DATEDIFF(NOW(), s.time)
FROM plugin_sw_vmware_healthmon_hosts h
JOIN
( SELECT clientid
, locationid
, hostname
, MAX(scantime) Time
FROM labtech.plugin_sw_vmware_healthmon_scans
GROUP
BY clientid
, locationid
, hostname
) s
ON h.clientid = s.clientid
AND h.locationid = s.locationid
AND h.hostname = s.hostname
JOIN clients c
ON c.clientid = h.clientid
JOIN plugin_sw_vmware_healthmon_cimdata d
ON d.clientid = h.clientid
AND d.locationid = h.locationid
AND d.hostname = h.hostname
JOIN plugin_sw_vmware_healthmon_types t
ON t.datavalue = d.cim_value
AND t.datatype = h.vender
WHERE d.cim_item LIKE '%critical array%'
ORDER
BY c.name;
The output is here:
ESXi Host Name Client Name Item Type RAID Status Last Updated (days ago)
192.14.13.2 Corp1 disk array 1 Good 0
192.14.13.2 Corp1 disk array 2 Good 0
192.14.13.2 Corp1 disk array 3 Good 0
192.14.13.2 Corp1 disk array 4 Good 0
192.14.13.2 Corp1 drisk array 5 Good 0
192.16.11.5 Corp 2 disk array 1 Good 4
192.16.11.5 Corp 2 disk array 2 Good 4
192.16.11.5 Corp 2 disk array 3 Good 4
192.16.11.5 Corp 2 disk array 4 Good 4
192.16.11.5 Corp 2 drisk array 5 Good 4
What I would like to do is combine all the results for Corp1 in 1 row and Corp2 in a second row so that it looks like this:
ESXi Host Name Client Name Item Type RAID Status Last Updated (days ago)
192.14.13.2 Corp1 disk array 1, disk array 2, disk array 3, disk array 4, disk array 5 Good 0
192.16.11.5 Corp2 disk array 1, disk array 2, disk array 3, disk array 4, disk array 5 Good 0
Any ideas how to do this in my query?