| Line 45... |
Line 45... |
| 45 |
selectSql = '''select i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), IFNULL(i.model_number, ''),
|
45 |
selectSql = '''select i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), IFNULL(i.model_number, ''),
|
| 46 |
i.color, d.monthname, d.monthnumber, d.dayofmonth, count(*) as quantity
|
46 |
i.color, d.monthname, d.monthnumber, d.dayofmonth, count(*) as quantity
|
| 47 |
from sales s
|
47 |
from sales s
|
| 48 |
join item i on (i.id = s.item_id)
|
48 |
join item i on (i.id = s.item_id)
|
| 49 |
join datedim d on (d.date_id = s.date_id)
|
49 |
join datedim d on (d.date_id = s.date_id)
|
| 50 |
where d.monthnumber in (month(now()) -2, month(now())-1)
|
50 |
where d.monthnumber in (month(now()), month(now())-1)
|
| 51 |
group by i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''),
|
51 |
group by i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''),
|
| 52 |
IFNULL(i.model_number, ''), i.color, d.monthname, d.monthnumber, d.dayofmonth
|
52 |
IFNULL(i.model_number, ''), i.color, d.monthname, d.monthnumber, d.dayofmonth
|
| 53 |
'''
|
53 |
'''
|
| 54 |
conn = getDbConnection()
|
54 |
conn = getDbConnection()
|
| 55 |
monthdatesmap = {}
|
55 |
monthdatesmap = {}
|