From df6de7e74c34e861bda3e5fb4750a837fc499773 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 14 Jun 2024 14:55:03 +0200 Subject: [PATCH] fix: refs #194195 item_getAtp --- db/routines/vn/procedures/item_getAtp.sql | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/db/routines/vn/procedures/item_getAtp.sql b/db/routines/vn/procedures/item_getAtp.sql index 8266e58da..d02d7cc90 100644 --- a/db/routines/vn/procedures/item_getAtp.sql +++ b/db/routines/vn/procedures/item_getAtp.sql @@ -20,12 +20,11 @@ BEGIN SELECT itemFk, warehouseFk, vDated, 0 FROM (SELECT DISTINCT itemFk, warehouseFk FROM tmp.itemCalc) t2 ) t1 - GROUP BY itemFk, warehouseFk, dated - ORDER BY itemFk, warehouseFk, dated; + GROUP BY itemFk, warehouseFk, dated; - SET @lastItemFk := 0; - SET @lastWareHouseFk := 0; - SET @lastQuantity := 0; + SET @lastItemFk = 0; + SET @lastWareHouseFk = 0; + SET @lastQuantity = 0; CREATE OR REPLACE TEMPORARY TABLE tmp.itemAtp (INDEX (itemFk, wareHouseFk)) @@ -40,6 +39,8 @@ BEGIN @lastItemFk := itemFk, @lastWareHouseFk := wareHouseFk FROM tItemOrdered + ORDER BY itemFk, warehouseFk, dated + LIMIT 10000000000000000000 )sub GROUP BY itemFk, wareHouseFk; -- 2.40.1