feat: refs #7681 Optimization and refactor #2707
|
@ -8,16 +8,11 @@ BEGIN
|
|||
*
|
||||
* @param vSelf Id ruta
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tRouteVolume
|
||||
ENGINE = MEMORY
|
||||
SELECT IFNULL(SUM(volume), 0) volume
|
||||
FROM saleVolume
|
||||
WHERE routeFk = vSelf;
|
||||
DECLARE vVolume DECIMAL(10,1)
|
||||
DEFAULT (SELECT SUM(volume) FROM saleVolume WHERE routeFk = vSelf);
|
||||
|
||||
UPDATE `route`
|
||||
SET m3 = (SELECT volume FROM tRouteVolume)
|
||||
SET m3 = IFNULL(vVolume, 0)
|
||||
WHERE id = vSelf;
|
||||
|
||||
DROP TEMPORARY TABLE tRouteVolume;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue