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

20 lines
558 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`,
`rs`.`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`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`roadmapStopFk`)
)
WHERE `e`.`id` IS NULL
AND `rs`.`eta` > `util`.`VN_CURDATE`()