|
@@ -21,6 +21,22 @@
|
|
|
((sum(charge) / sum(activation)) / #{discount}) afterActivationPrice, -- 激活单价
|
|
|
sum(event_register) eventRegister, -- 注册数
|
|
|
|
|
|
+ sum(form_count + activation) conversionNum, -- 转化数
|
|
|
+
|
|
|
+ (case
|
|
|
+ when sum(activation +form_count) != 0
|
|
|
+ then (sum(charge) / sum(activation +form_count))
|
|
|
+ else 0
|
|
|
+ end
|
|
|
+ ) conversionPrice, -- 转化单价
|
|
|
+
|
|
|
+ (case
|
|
|
+ when sum(activation +form_count) != 0
|
|
|
+ then (sum(charge) / sum(activation +form_count)) / #{discount}
|
|
|
+ else 0
|
|
|
+ end
|
|
|
+ ) afterConversionPrice, -- 折后转化单价
|
|
|
+
|
|
|
(case
|
|
|
when sum(event_register) != 0
|
|
|
then (sum(charge) / sum(event_register))
|
|
@@ -57,13 +73,13 @@
|
|
|
((sum(charge) / sum(activation)) / #{discount}) afterActivationPrice, -- 激活单价
|
|
|
account_id accountId,
|
|
|
(select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName,
|
|
|
- sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
+ sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
(case
|
|
|
when sum(activation) != 0
|
|
|
then (sum(event_next_day_stay)/sum(activation))
|
|
|
else 0
|
|
|
end
|
|
|
- ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
+ ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
from
|
|
|
ctop_kuaishou_report_daily_account
|
|
|
where account_id in
|
|
@@ -92,6 +108,8 @@
|
|
|
(sum(charge) / sum(activation)) activationPrice, -- 激活单价
|
|
|
((sum(charge) / sum(activation)) / #{discount}) afterActivationPrice, -- 激活单价
|
|
|
sum(event_register) eventRegister, -- 注册数
|
|
|
+ sum(form_count + activation) conversionNum, -- 转化数
|
|
|
+ (sum(charge) / sum(activation +form_count )) conversionPrice, -- 转化单价
|
|
|
(case
|
|
|
when sum(event_register) != 0
|
|
|
then (sum(charge) / sum(event_register))
|
|
@@ -100,13 +118,13 @@
|
|
|
) eventRegisterCost, -- 注册成本
|
|
|
account_id accountId,
|
|
|
(select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName,
|
|
|
- sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
+ sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
(case
|
|
|
when sum(activation) != 0
|
|
|
then (sum(event_next_day_stay)/sum(activation))
|
|
|
else 0
|
|
|
end
|
|
|
- ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
+ ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
from
|
|
|
ctop_kuaishou_report_daily_account
|
|
|
where stat_date <= #{startDate}
|
|
@@ -135,6 +153,15 @@
|
|
|
sum(activation) activationCount, -- 激活数
|
|
|
(sum(charge) / sum(activation)) activationPrice, -- 激活单价
|
|
|
sum(event_register) eventRegister, -- 注册数
|
|
|
+ sum(form_count + activation) conversionNum, -- 转化数
|
|
|
+
|
|
|
+ (
|
|
|
+ case when sum(activation +form_count ) != 0
|
|
|
+ then (sum(charge) / sum(activation +form_count))
|
|
|
+ else 0
|
|
|
+ end
|
|
|
+ )conversionPrice, -- 转化单价
|
|
|
+
|
|
|
|
|
|
(case
|
|
|
when sum(event_register) != 0
|
|
@@ -173,6 +200,14 @@
|
|
|
sum(activation) activationCount, -- 激活数
|
|
|
(sum(charge) / sum(activation)) activationPrice, -- 激活单价
|
|
|
sum(event_register) eventRegister, -- 注册数
|
|
|
+ sum(form_count + activation) conversionNum, -- 转化数
|
|
|
+ (
|
|
|
+ case when sum(activation +form_count ) != 0
|
|
|
+ then (sum(charge) / sum(activation +form_count))
|
|
|
+ else 0
|
|
|
+ end
|
|
|
+ )conversionPrice, -- 转化单价
|
|
|
+
|
|
|
(case
|
|
|
when sum(event_register) != 0
|
|
|
then (sum(charge) / sum(event_register))
|
|
@@ -181,13 +216,13 @@
|
|
|
) eventRegisterCost, -- 注册成本
|
|
|
account_id accountId,
|
|
|
(select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName,
|
|
|
- sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
+ sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
(case
|
|
|
when sum(activation) != 0
|
|
|
then ( sum(event_next_day_stay) / sum(activation) )
|
|
|
else 0
|
|
|
end
|
|
|
- ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
+ ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
from
|
|
|
ctop_kuaishou_report_daily_account
|
|
|
where stat_date = #{statDate}
|
|
@@ -416,30 +451,17 @@
|
|
|
sum(bclick) bClick,-- 行为数
|
|
|
(
|
|
|
CASE
|
|
|
- WHEN sum(form_count) != 0 THEN
|
|
|
- sum(form_count)
|
|
|
- WHEN sum(activation) != 0 THEN
|
|
|
- sum(activation)
|
|
|
- ELSE
|
|
|
- 0
|
|
|
- END
|
|
|
- ) conversions, -- 转化数
|
|
|
- (
|
|
|
- CASE
|
|
|
- WHEN sum(form_count) != 0 THEN
|
|
|
- sum(charge) / sum(form_count)
|
|
|
- WHEN sum(activation) != 0 THEN
|
|
|
- sum(charge) / sum(activation)
|
|
|
+ WHEN sum(form_count + activation) != 0 THEN
|
|
|
+ sum(charge) / sum(form_count + activation)
|
|
|
ELSE
|
|
|
0
|
|
|
END
|
|
|
) conversionPrice, -- 转化单价
|
|
|
+ sum(form_count + activation) conversions, -- 转化数
|
|
|
(
|
|
|
CASE
|
|
|
- WHEN sum(form_count) != 0 THEN
|
|
|
- (sum(charge) / sum(form_count)) / #{discount}
|
|
|
- WHEN sum(activation) != 0 THEN
|
|
|
- (sum(charge) / sum(activation)) / #{discount}
|
|
|
+ WHEN sum(form_count + activation) != 0 THEN
|
|
|
+ (sum(charge) / sum(form_count + activation)) / #{discount}
|
|
|
ELSE
|
|
|
0
|
|
|
END
|
|
@@ -451,13 +473,13 @@
|
|
|
else 0
|
|
|
end
|
|
|
) eventRegisterCost, -- 注册成本
|
|
|
- sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
+ sum(event_next_day_stay) eventNextDayStay, -- 次留数
|
|
|
(case
|
|
|
when sum(activation) != 0
|
|
|
then (sum(event_next_day_stay)/sum(activation))
|
|
|
else 0
|
|
|
end
|
|
|
- ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
+ ) eventNextDayStayRatio -- 次留率=次留数/激活数
|
|
|
|
|
|
from
|
|
|
ctop_kuaishou_report_daily_account
|
|
@@ -520,34 +542,21 @@
|
|
|
else 0
|
|
|
end
|
|
|
) cpm,
|
|
|
-
|
|
|
+ sum(form_count + activation) conversions, -- 转化数
|
|
|
sum(bclick) bClick,-- 行为数
|
|
|
+
|
|
|
(
|
|
|
CASE
|
|
|
- WHEN sum(form_count) != 0 THEN
|
|
|
- sum(form_count)
|
|
|
- WHEN sum(activation) != 0 THEN
|
|
|
- sum(activation)
|
|
|
- ELSE
|
|
|
- 0
|
|
|
- END
|
|
|
- ) conversions, -- 转化数
|
|
|
- (
|
|
|
- CASE
|
|
|
- WHEN sum(form_count) != 0 THEN
|
|
|
- sum(charge) / sum(form_count)
|
|
|
- WHEN sum(activation) != 0 THEN
|
|
|
- sum(charge) / sum(activation)
|
|
|
+ WHEN sum(activation + form_count) != 0 THEN
|
|
|
+ sum(charge) / sum(activation + form_count)
|
|
|
ELSE
|
|
|
0
|
|
|
END
|
|
|
) conversionPrice, -- 转化单价
|
|
|
(
|
|
|
CASE
|
|
|
- WHEN sum(form_count) != 0 THEN
|
|
|
- (sum(charge) / sum(form_count)) / #{discount}
|
|
|
- WHEN sum(activation) != 0 THEN
|
|
|
- (sum(charge) / sum(activation)) / #{discount}
|
|
|
+ WHEN sum(activation + form_count) != 0 THEN
|
|
|
+ (sum(charge) / sum(activation + form_count)) / #{discount}
|
|
|
ELSE
|
|
|
0
|
|
|
END
|