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

19 lines
523 B
MySQL
Raw Normal View History

2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTimeExpended`
AS SELECT `e`.`ticketFk` AS `ticketFk`,
min(`e`.`created`) AS `started`,
max(`e`.`created`) AS `finished`,
max(`e`.`counter`) AS `cajas`,
`w`.`code` AS `code`,
`t`.`warehouseFk` AS `warehouseFk`
FROM (
(
`vn`.`expedition` `e`
JOIN `vn`.`worker` `w` ON(`w`.`id` = `e`.`workerFk`)
)
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `e`.`ticketFk`)
)
WHERE `e`.`created` > `util`.`VN_CURDATE`()
GROUP BY `e`.`ticketFk`