with t1 as(select max(date(delivered_ts)) as max_d FROM parcel), t2 as( select a.courier_id, courier_name, city, count(*) as orders_7d, count(case when timestampdiff(second,shipped_ts,delivered_ts)/60 <=promised_minutes then 1 else null end) as on_time_7d, round(count(case when timestampdiff(seco...