refs #6769 Fix
This commit is contained in:
parent
6f0196d656
commit
50c9ded103
|
@ -34,7 +34,8 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
-- Calcula el ultimo dia de vida para cada producto
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemRange
|
||||
-- Tiene tmp a propósito, porque si no falla al utilizarlo en el WITH
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemRange
|
||||
(PRIMARY KEY (itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT i.id itemFk,
|
||||
|
@ -206,7 +207,7 @@ BEGIN
|
|||
NULL
|
||||
FROM hedera.orderRow r
|
||||
JOIN hedera.`order` o ON o.id = r.orderFk
|
||||
JOIN tItemRange ir ON ir.itemFk = r.itemFk
|
||||
JOIN tmp.itemRange ir ON ir.itemFk = r.itemFk
|
||||
JOIN vn.client c ON c.id = o.customer_id
|
||||
WHERE r.shipment >= vDateInventory
|
||||
AND (ir.ended IS NULL OR r.shipment <= ir.ended)
|
||||
|
@ -308,6 +309,6 @@ BEGIN
|
|||
|
||||
DROP TEMPORARY TABLE
|
||||
tItemDiary,
|
||||
tItemRange;
|
||||
tmp.itemRange;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue