19 lines
525 B
SQL
19 lines
525 B
SQL
CREATE OR REPLACE DEFINER=`root`@`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`
|