SELECT
    roundtime AS `Round Time`,
    sInduction_Name AS `Induction Name`,
    COUNT(*) AS `Total`
FROM (
    
    -- ONLY S03 from item_data now
    SELECT
        FROM_UNIXTIME(
            FLOOR(UNIX_TIMESTAMP(t_stamp) /
                CEIL(TIMESTAMPDIFF(SECOND, :starttime, :endtime) / 24.0)
            ) *
            CEIL(TIMESTAMPDIFF(SECOND, :starttime, :endtime) / 24.0)
        ) AS roundtime,
        'S03' AS sInduction_Name
    FROM item_data
    WHERE t_stamp BETWEEN :starttime AND :endtime
        AND adiSort_Code_0 NOT IN (11, 15)
        AND sLocation_ID LIKE 'S03%'
        AND (:inductionname IS NULL OR :inductionname = '' OR :inductionname = 'S03')
    GROUP BY roundtime

    ORDER BY roundtime ASC
) basa;
