|
@@ -12,7 +12,7 @@ def book_rank(start,end,book,stage,type,page,page_size,order_by,order):
|
|
|
op3 = f" and dt<='{end}' " if end else ''
|
|
|
op4 = f" order by {order_by} {order}" if order_by and order else ''
|
|
|
op5=f" and stage='{stage}'" if stage else ''
|
|
|
- op6=f" and type={type}" if type else ''
|
|
|
+ op6=f" and type='{type}'" if type else ''
|
|
|
|
|
|
sql=f"""select
|
|
|
concat(DATE_FORMAT(min(dt),'%Y/%m/%d') ,'~',DATE_FORMAT(max(dt),'%Y/%m/%d')) date,
|
|
@@ -28,7 +28,7 @@ sum(first_order_amount) first_amount,
|
|
|
sum(reg_order_amount) reg_amount,
|
|
|
round(sum(first_order_amount)/sum(cost),4) first_roi,
|
|
|
round(sum(reg_order_amount)/sum(cost),4) roi
|
|
|
-from dw_channel where 1=1 {op1} {op2} {op3} {op5} GROUP BY channel,book,pitcher,stage,type
|
|
|
+from dw_channel where 1=1 {op1} {op2} {op3} {op5} {op6} GROUP BY channel,book,pitcher,stage,type
|
|
|
{op4}"""
|
|
|
print(sql)
|
|
|
return getLimitData(db.dm,sql,page,page_size)
|