SELECT
    CONCAT(DATE(dc.t_stamp), ' ', HOUR(dc.t_stamp), ':00') AS StartTimestamp,
    CONCAT('H', TIMESTAMPDIFF(HOUR,
        DATE_FORMAT(dc.t_stamp, "%Y-%m-%d %H:00:00"),
        DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))) AS Hour,

    CONCAT(ROUND(SUM(dc.ulgl1 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL1,
    CONCAT(ROUND(SUM(dc.ulgl2 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL2,
    CONCAT(ROUND(SUM(dc.ulgl3 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL3,
    CONCAT(ROUND(SUM(dc.ulgl4 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL4,
    CONCAT(ROUND(SUM(dc.ulgl5 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL5,
    CONCAT(ROUND(SUM(dc.ulgl6 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL6,
    CONCAT(ROUND(SUM(dc.ulgl7 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL7,
    CONCAT(ROUND(SUM(dc.ulgl8 = 1)/COUNT(*)*100*2, 2),'%') AS ULGL8

FROM dumper_cycles dc
WHERE dc.t_stamp BETWEEN :starttime AND :endtime
GROUP BY HOUR(dc.t_stamp);
