From 2962bd13c7db6bf60f52546d565f5d063b8eec63 Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 30 Sep 2024 11:59:22 +0200 Subject: [PATCH] fix: refs #8030 buyer prefers to add multiple zoneGeoFk Instead of choosing the deepest zoneGeo, buyer wants all to be merged Refs: #8030 --- db/routines/vn/procedures/catalog_componentCalculate.sql | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/procedures/catalog_componentCalculate.sql b/db/routines/vn/procedures/catalog_componentCalculate.sql index ee246f9f8..7a0a1744b 100644 --- a/db/routines/vn/procedures/catalog_componentCalculate.sql +++ b/db/routines/vn/procedures/catalog_componentCalculate.sql @@ -28,9 +28,7 @@ BEGIN CREATE OR REPLACE TEMPORARY TABLE tPriceDelta (INDEX (itemFk)) ENGINE = MEMORY - SELECT * FROM - ( - SELECT i.id itemFk, + SELECT i.id itemFk, SUM(IFNULL(pd.absIncreasing,0)) absIncreasing, SUM(IFNULL(pd.ratIncreasing,0)) ratIncreasing, pd.warehouseFk @@ -48,9 +46,7 @@ BEGIN WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped) AND (pd.toDated IS NULL OR pd.toDated >= vShipped) AND (pd.zoneGeoFk IS NULL OR zg2.lft BETWEEN zg.lft AND zg.rgt) - ORDER BY zg.`depth` DESC - LIMIT 10000000000000000000 - ) sub GROUP BY itemFk; + GROUP BY itemFk; CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice (INDEX (itemFk))