salix/db/routines/vn/views/expeditionTicket_NoBoxes.sql

20 lines
566 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTicket_NoBoxes`
AS SELECT `t`.`id` AS `ticketFk`,
`t`.`warehouseFk` AS `warehouseFk`,
`t`.`routeFk` AS `routeFk`,
`et`.`description` AS `description`
FROM (
(
(
`vn`.`ticket` `t`
LEFT JOIN `vn`.`expedition` `e` ON(`e`.`ticketFk` = `t`.`id`)
)
JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
)
JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`)
)
WHERE `e`.`id` IS NULL
AND `et`.`eta` > `util`.`VN_CURDATE`()