a guest Mar 28th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- SELECT * FROM (SELECT *, CAST(CONCAT(CAST(DEADLINE_DAY as DATE), ' ' ,CAST('22:00' as TIME)) as DATETIME) AS DEADLINE FROM (SELECT *,@days:=CAST(day_deadline_days AS UNSIGNED), DATE_ADD(day_next_delivery, INTERVAL -@days DAY) AS DEADLINE_DAY FROM `gm_full_order` AS GFO JOIN gm_zone_day AS ZD ON GFO.address_zone=ZD.zd_zone AND order_delivered IS NULL JOIN gm_next_day AS ND ON ZD.zd_day=ND.day_id) AS FT) AS FT2 WHERE FT2.DEADLINE < `FT2`.`order_time`
RAW Paste Data