[Y] 修复每日自动化生成报表数据异常情况

master
taylor.dang 5 years ago
parent 92e28f6e8b
commit 4ece67e6aa

@ -689,8 +689,8 @@
COUNT(DISTINCT o.customer_id) AS customers,
o.channel AS channel,
ifnull(SUM(if(t.transaction_type = 'Credit', t.clearing_amount, 0)), 0) AS total,
ifnull(SUM(if(t.refund_id>0, t.clearing_amount, 0)), 0) AS refund_amount,
SUM(if(t.refund_id>0, 1, 0)) AS refund_orders,
ifnull(SUM(if(t.transaction_type = 'Debit', t.clearing_amount, 0)), 0) AS refund_amount,
SUM(if(t.transaction_type = 'Debit', 1, 0)) AS refund_orders,
round(SUM(if(t.transaction_type='Credit',t.clearing_amount,0))/COUNT(DISTINCT o.customer_id),2) single_amount
FROM pmt_transactions t
INNER JOIN pmt_orders o ON o.order_id = t.order_id

Loading…
Cancel
Save