From 30ac174b1ee72b9ec0fbdefa7ed1c8b1ef45def0 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 21 Nov 2019 12:01:21 +0100 Subject: [PATCH] SQL grouping quoted --- .../02-catalog_componentCalculate.sql | 12 ++++++------ .../10100-allSaints/03-ticketComponentCalculate.sql | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/db/changes/10100-allSaints/02-catalog_componentCalculate.sql b/db/changes/10100-allSaints/02-catalog_componentCalculate.sql index ebfc0a1f3..9d4df64c9 100644 --- a/db/changes/10100-allSaints/02-catalog_componentCalculate.sql +++ b/db/changes/10100-allSaints/02-catalog_componentCalculate.sql @@ -56,7 +56,7 @@ proc: BEGIN IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3, IFNULL(pf.rate3, 0) AS minPrice, IFNULL(pf.packing, b.packing) packing, - IFNULL(pf.`grouping`, b.`grouping`) grouping, + IFNULL(pf.`grouping`, b.`grouping`) `grouping`, ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, tl.buyFk, i.typeFk, @@ -201,7 +201,7 @@ proc: BEGIN SELECT tcc.warehouseFk, tcc.itemFk, 1 rate, - IF(tcc.groupingMode = 1, tcc.`grouping`, 1) grouping, + IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc @@ -211,12 +211,12 @@ proc: BEGIN AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) GROUP BY tcs.warehouseFk, tcs.itemFk; - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg) + INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) SELECT tcc.warehouseFk, tcc.itemFk, 2 rate, - tcc.packing grouping, + tcc.packing `grouping`, SUM(tcs.sumCost) price, SUM(tcs.sumCost) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc @@ -226,12 +226,12 @@ proc: BEGIN AND tcc.packing > 0 AND tcc.available >= tcc.packing) GROUP BY tcs.warehouseFk, tcs.itemFk; - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg) + INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) SELECT tcc.warehouseFk, tcc.itemFk, 3 rate, - tcc.available grouping, + tcc.available `grouping`, SUM(tcs.sumCost) price, SUM(tcs.sumCost) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc diff --git a/db/changes/10100-allSaints/03-ticketComponentCalculate.sql b/db/changes/10100-allSaints/03-ticketComponentCalculate.sql index e4b10ada5..4547c4c64 100644 --- a/db/changes/10100-allSaints/03-ticketComponentCalculate.sql +++ b/db/changes/10100-allSaints/03-ticketComponentCalculate.sql @@ -57,7 +57,7 @@ proc: BEGIN IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3, IFNULL(pf.rate3, 0) AS minPrice, IFNULL(pf.packing, b.packing) packing, - IFNULL(pf.`grouping`, b.`grouping`) grouping, + IFNULL(pf.`grouping`, b.`grouping`) `grouping`, ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, tl.buyFk, i.typeFk, @@ -204,7 +204,7 @@ proc: BEGIN SELECT tcc.warehouseFk, tcc.itemFk, 1 rate, - IF(tcc.groupingMode = 1, tcc.`grouping`, 1) grouping, + IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, CAST(SUM(tcs.sumCost) / weightGrouping AS DECIMAL(10,2)) priceKg FROM tmp.ticketComponentCalculate tcc @@ -214,12 +214,12 @@ proc: BEGIN AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) GROUP BY tcs.warehouseFk, tcs.itemFk; - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg) + INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) SELECT tcc.warehouseFk, tcc.itemFk, 2 rate, - tcc.packing grouping, + tcc.packing `grouping`, SUM(tcs.sumCost) price, SUM(tcs.sumCost) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc @@ -229,12 +229,12 @@ proc: BEGIN AND tcc.packing > 0 AND tcc.available >= tcc.packing) GROUP BY tcs.warehouseFk, tcs.itemFk; - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg) + INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) SELECT tcc.warehouseFk, tcc.itemFk, 3 rate, - tcc.available grouping, + tcc.available `grouping`, SUM(tcs.sumCost) price, SUM(tcs.sumCost) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc