salix/db/routines/bs/views/packingSpeed.sql

20 lines
572 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bs`.`packingSpeed`
AS SELECT HOUR(`e`.`created`) AS `hora`,
MINUTE(`e`.`created`) AS `minuto`,
IFNULL(
`p`.`volume`,
`p`.`width` * `p`.`height` * `p`.`depth`
) AS `cm3`,
`t`.`warehouseFk` AS `warehouse_id`,
`e`.`created` AS `odbc_date`
FROM (
(
`vn`.`expedition` `e`
JOIN `vn`.`packaging` `p` ON(`p`.`id` = `e`.`packagingFk`)
)
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `e`.`ticketFk`)
)
WHERE `e`.`created` BETWEEN `util`.`VN_CURDATE`() AND `util`.`dayend`(`util`.`VN_CURDATE`())