|
@@ -2684,8 +2684,14 @@
|
|
|
count(oid) as 'orderNum',
|
|
|
sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNum',
|
|
|
sum(order_amount) as 'orderAmount',
|
|
|
- sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
|
|
|
- sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN order_status != 80 THEN regimental_promotion_amount
|
|
|
+ ELSE 0
|
|
|
+ END
|
|
|
+ ) AS 'regimentalPromotionAmount',
|
|
|
+ sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
|
|
|
+ 'totalRegimentalSettleAmount'
|
|
|
from kuaishou_supply_chain
|
|
|
where stat_date >= #{start}
|
|
|
and stat_date <= #{end}
|
|
@@ -2744,8 +2750,14 @@
|
|
|
sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNum',
|
|
|
concat(round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) * 100, 2), '%') as 'validOrderRate',
|
|
|
round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
|
|
|
- round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
|
|
|
- round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN t2.order_status != 80 THEN t2.regimental_promotion_amount
|
|
|
+ ELSE 0
|
|
|
+ END
|
|
|
+ ) AS 'regimentalPromotionAmount',
|
|
|
+ sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
|
|
|
+ 'totalRegimentalSettleAmount'
|
|
|
from promoter_bind_channel_date t1
|
|
|
left join kuaishou_supply_chain t2
|
|
|
on t1.promoter_id = t2.promoter_id and t1.stat_date = t2.stat_date
|
|
@@ -2775,8 +2787,14 @@
|
|
|
sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNum',
|
|
|
concat(round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) * 100, 2), '%') as 'validOrderRate',
|
|
|
round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
|
|
|
- round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
|
|
|
- round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN t2.order_status != 80 THEN t2.regimental_promotion_amount
|
|
|
+ ELSE 0
|
|
|
+ END
|
|
|
+ ) AS 'regimentalPromotionAmount',
|
|
|
+ sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
|
|
|
+ 'totalRegimentalSettleAmount'
|
|
|
from promoter_bind_channel_date t1
|
|
|
left join kuaishou_supply_chain t2
|
|
|
on t1.promoter_id = t2.promoter_id and t1.stat_date = t2.stat_date
|