SELECT concat(date(alltable.t_stamp), ' ', hour(alltable.t_stamp), ':00') as StartTimestamp,
	concat('H',TIMESTAMPDIFF(HOUR,DATE_FORMAT(alltable.t_stamp,"%Y-%m-%d %H:00:00"),DATE_FORMAT(now(),"%Y-%m-%d %H:00:00"))) as Hour,
	concat(round(COUNT(*)/COUNT(*) * 100,2),'%') AS Inducted,
    concat(round(SUM(alltable.ACTUAL_DEST NOT IN ('S013001', 'S012069', 'S011076'))/COUNT(*) * 100,2),'%') AS Sorted,
    concat(round(SUM((alltable.ACTUAL_DEST IN ('S013001', 'S012069', 'S011076')) AND (alltable.DivertStatus & (128|256|512|1024|4096|65536)) > 0)/COUNT(*) * 100,2),'%') AS AwcsRecirc,
    concat(round(SUM((alltable.ACTUAL_DEST IN ('S013001', 'S012069', 'S011076')) AND (alltable.DivertStatus & (4|32|262144|524288|1048576)) > 0)/COUNT(*) * 100,2),'%') AS OperationalRecirc,
	concat(round(SUM((alltable.ACTUAL_DEST IN ('S013001', 'S012069', 'S011076')) AND (alltable.DivertStatus & (2|8|16|64|8192|16384|131072|2097152)) > 0)/COUNT(*) * 100,2),'%') AS MachineRecirc
FROM alltable
Where (alltable.t_stamp BETWEEN :starttime AND :endtime)
GROUP BY hour(alltable.t_stamp)