CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`expeditionCommon` AS SELECT `rs`.`id` AS `truckFk`, `rs`.`eta` AS `eta`, IFNULL(ucase(`rs`.`description`), 'SIN ESCANEAR') AS `description`, `es`.`palletFk` AS `palletFk`, `t`.`routeFk` AS `routeFk`, `es`.`id` AS `scanFk`, `e`.`id` AS `expeditionFk`, `r`.`expeditionTruckFk` AS `expeditionTruckFk`, `t`.`warehouseFk` AS `warehouseFk`, `e`.`created` AS `lastPacked`, `t`.`id` AS `ticketFk` FROM ( ( ( ( ( `vn`.`roadmapStop` `et` LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`expeditionTruckFk`) ) LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`) ) LEFT JOIN `vn`.`expedition` `e` ON(`t`.`id` = `e`.`ticketFk`) ) LEFT JOIN `vn`.`expeditionScan` `es` ON(`e`.`id` = `es`.`expeditionFk`) ) LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`es`.`palletFk` = `ep`.`id`) ) WHERE `rs`.`eta` >= `util`.`VN_CURDATE`()