This commit is contained in:
parent
56aec1c781
commit
bbd948c654
|
@ -23,7 +23,6 @@ proc: BEGIN
|
|||
* @param tmp.comparativeFilterType(filterFk INT ,itemTypeFk INT)
|
||||
* @return tmp.comparative
|
||||
*/
|
||||
|
||||
DECLARE vDayRangeStart DATE;
|
||||
DECLARE vDayRangeEnd DATE;
|
||||
DECLARE w1, w2, w3, w4, w5, w6, w7 INT;
|
||||
|
@ -150,14 +149,14 @@ proc: BEGIN
|
|||
SUM(IF(c.timePeriod = y7, c.price, 0)) lprice7
|
||||
FROM tmp.itemInventory ai
|
||||
JOIN comparative c ON c.itemFk = ai.id
|
||||
JOIN warehouse w on w.id = c.warehouseFk
|
||||
JOIN warehouse w ON w.id = c.warehouseFk
|
||||
JOIN tTable wt ON c.timePeriod = wt.ly
|
||||
WHERE (vWarehouseFk IS NULL OR vWarehouseFk = c.warehouseFk)
|
||||
AND w.isComparative
|
||||
AND (vCountryFk IS NULL OR c.countryFk = vCountryFk)
|
||||
GROUP BY ai.id;
|
||||
|
||||
-- Genera una tabla con los datos de hace DOS años.
|
||||
-- Genera una tabla con los datos de hace 2 años
|
||||
CREATE OR REPLACE TEMPORARY TABLE tTwoYearsAgo
|
||||
(KEY (tItemFk))
|
||||
ENGINE = MEMORY
|
||||
|
@ -178,7 +177,7 @@ proc: BEGIN
|
|||
SUM(IF(c.timePeriod = z7, c.price, 0)) vlprice7
|
||||
FROM tmp.itemInventory ai
|
||||
JOIN comparative c ON c.itemFk = ai.id
|
||||
JOIN warehouse w on w.id = c.warehouseFk
|
||||
JOIN warehouse w ON w.id = c.warehouseFk
|
||||
JOIN tTable wt ON c.timePeriod = wt.zy
|
||||
WHERE (vWarehouseFk IS NULL OR vWarehouseFk = c.warehouseFk)
|
||||
AND w.isComparative
|
||||
|
@ -229,7 +228,7 @@ proc: BEGIN
|
|||
) t
|
||||
GROUP BY t.itemFk;
|
||||
|
||||
-- Genera la tabla con la comparativa.
|
||||
-- Genera la tabla con la comparativa
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.comparative
|
||||
ENGINE = MEMORY
|
||||
SELECT it.subName productor,
|
||||
|
|
Loading…
Reference in New Issue