SQL grouping quoted
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
parent
0733ef8949
commit
30ac174b1e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue