SELECT 
    COALESCE(c.sActual_Dest_ID, 'N/A') AS Lane,
    COALESCE(c.Total_count, 0) AS Total_count,
    COALESCE(c.DestFull_count, 0) AS DestFull_count
FROM (SELECT 1) AS p
LEFT JOIN (
    SELECT 
        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 sActual_Dest_ID
) AS c ON 1=1
ORDER BY c.sActual_Dest_ID;

