SELECT
    roundtime AS `Round Time`,
    sActual_Dest_ID AS Lane,
    COALESCE(Total_count, 0) AS `Total Count`,
    COALESCE(DestFull_count, 0) AS DestFull_count
FROM (
    SELECT
        FROM_UNIXTIME(
            FLOOR(UNIX_TIMESTAMP(t_stamp) / 
                CEIL(TIMESTAMPDIFF(SECOND, :starttime, :endtime) / 24.0)
            ) * 
            CEIL(TIMESTAMPDIFF(SECOND, :starttime, :endtime) / 24.0)
        ) AS roundtime,
        sActual_Dest_ID,
        COUNT(*) AS Total_count,
        SUM(CASE WHEN adiSort_Code_0 = 5 THEN 1 ELSE 0 END) AS DestFull_count
    FROM item_data
    WHERE t_stamp BETWEEN :starttime AND :endtime
        AND (sActual_Dest_ID LIKE CONCAT(:lane, '%') OR :lane IS NULL OR :lane = '')
    GROUP BY roundtime, sActual_Dest_ID
    ORDER BY roundtime ASC
) basa
WHERE COALESCE(DestFull_count, 0) > 0