12 lines
443 B
SQL
12 lines
443 B
SQL
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
SQL SECURITY DEFINER
|
|
VIEW `vn`.`productionVolume_LastHour`
|
|
AS SELECT cast(
|
|
sum(`productionVolume`.`cm3` / 1000000) AS decimal(10, 0)
|
|
) AS `m3`,
|
|
`productionVolume`.`warehouseFk` AS `warehouseFk`
|
|
FROM `vn`.`productionVolume`
|
|
WHERE `productionVolume`.`created` > `util`.`VN_NOW`() + INTERVAL -1 HOUR
|
|
AND `productionVolume`.`warehouseFk` IN (1, 44, 60)
|
|
GROUP BY `productionVolume`.`warehouseFk`
|