|
@@ -1200,7 +1200,6 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
return cri;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 所有为空值的属性都不copy
|
|
|
*
|
|
@@ -2942,7 +2941,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
}
|
|
|
//如果没有排序条件给默认值
|
|
|
if (StringUtils.isBlank(dto.getSortFiled())) {
|
|
|
- dto.setSortFiled("dt");
|
|
|
+ dto.setSortFiled("cost_date");
|
|
|
}
|
|
|
if (StringUtils.isBlank(dto.getSortType())) {
|
|
|
dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
@@ -2959,7 +2958,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
}
|
|
|
//拼接游戏应用类型
|
|
|
if (dto.getClassify() != null) {
|
|
|
- cri.where().andEquals("classify", dto.getClassify());
|
|
|
+ cri.where().andEquals("game_classify", dto.getClassify());
|
|
|
}
|
|
|
//拼接SDK来源
|
|
|
if (StringUtils.isNotBlank(dto.getSourceSystem())) {
|
|
@@ -2969,10 +2968,11 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
if (dto.getRegisteredBeginDate() != null && dto.getRegisteredEndDate() != null) {
|
|
|
cri.where().andBetween("dt", dto.getRegisteredBeginDate(), dto.getRegisteredEndDate());
|
|
|
}
|
|
|
-
|
|
|
+ //拼接排序条件
|
|
|
+ Criteria orderByCri = Cnd.cri();
|
|
|
+ orderByCri.getOrderBy().orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
|
//创建sql查询数据
|
|
|
- Sql sql = Sqls.create("""
|
|
|
- """);
|
|
|
+ Sql sql = Sqls.create(getLtvDataByTableTypesSql(dto.getTableTypes(), cri) + orderByCri);
|
|
|
//设置自定义回传类型
|
|
|
sql.setCallback(Sqls.callback.entities());
|
|
|
sql.setEntity(dao.getEntity(LtvDataVO.class));
|
|
@@ -2989,11 +2989,2274 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
return new Page<>(list, pager);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * ltv数据总计一栏
|
|
|
+ * @param dto 前端查询参数实体
|
|
|
+ * @return 总计对象
|
|
|
+ */
|
|
|
@Override
|
|
|
public LtvDataTotalVO getLtvTotalData(LtvDataTotalDTO dto) {
|
|
|
- return null;
|
|
|
+ //如果没有传入查询时间默认查询当天
|
|
|
+ if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
|
|
|
+ dto.setRegisteredBeginDate(LocalDate.now());
|
|
|
+ dto.setRegisteredEndDate(LocalDate.now());
|
|
|
+ }
|
|
|
+ //默认查询总数据
|
|
|
+ if (StringUtils.isBlank(dto.getTableTypes())) {
|
|
|
+ dto.setTableTypes("total");
|
|
|
+ }
|
|
|
+ //新增查询条件
|
|
|
+ Criteria cri = Cnd.cri();
|
|
|
+ if (dto.getGameId() != null) {
|
|
|
+ //拼接游戏id
|
|
|
+ cri.where().andEquals("game_id", dto.getGameId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getSourceSystem())) {
|
|
|
+ //拼接SDK来源
|
|
|
+ cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
|
+ }
|
|
|
+ if (dto.getClassify() != null) {
|
|
|
+ cri.where().andEquals("game_classify", dto.getClassify());
|
|
|
+ }
|
|
|
+ if (dto.getRegisteredBeginDate() != null && dto.getRegisteredEndDate() != null) {
|
|
|
+ //拼接查询时间
|
|
|
+ cri.where().andBetween("dt", dto.getRegisteredBeginDate(), dto.getRegisteredEndDate());
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建sql 获取游戏数据部分的数据
|
|
|
+ Sql sqlGameData = Sqls.create(getLtvDataTotalGameData(dto.getTableTypes()) + cri);
|
|
|
+ //设置自定义回传对象
|
|
|
+ sqlGameData.setCallback(Sqls.callback.entity());
|
|
|
+ sqlGameData.setEntity(dao.getEntity(LtvDataTotalVO.class));
|
|
|
+ //执行sql
|
|
|
+ dao.execute(sqlGameData);
|
|
|
+ //得到每日总计对象
|
|
|
+ LtvDataTotalVO voGameData = sqlGameData.getObject(LtvDataTotalVO.class);
|
|
|
+
|
|
|
+ //创建sql 获取ltv数据部分的数据
|
|
|
+ Sql sqlLtvData = Sqls.create(getLtvDataTotalLtvData(dto.getTableTypes()) + cri);
|
|
|
+ //设置自定义回传对象
|
|
|
+ sqlLtvData.setCallback(Sqls.callback.entity());
|
|
|
+ sqlLtvData.setEntity(dao.getEntity(LtvDataTotalVO.class));
|
|
|
+ //执行sql
|
|
|
+ dao.execute(sqlLtvData);
|
|
|
+ //得到每日总计对象
|
|
|
+ LtvDataTotalVO voLtvData = sqlLtvData.getObject(LtvDataTotalVO.class);
|
|
|
+ //将两个对象的属性结合
|
|
|
+ copyNullProperties(voLtvData, voGameData);
|
|
|
+ //返回
|
|
|
+ return voGameData;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ltv每日数据查询sql
|
|
|
+ * @param type 查询的类型 buy -> 买量 ; nature -> 自然量 ; total -> 总量
|
|
|
+ * @param cri 查询条件
|
|
|
+ * @return String
|
|
|
+ */
|
|
|
+ private String getLtvDataByTableTypesSql(String type, Criteria cri) {
|
|
|
+ if ("buy".equals(type)) {
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ a.*,
|
|
|
+ b.*
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ dt cost_date,
|
|
|
+ game_name,
|
|
|
+ game_id,
|
|
|
+ game_classify,
|
|
|
+ source_system,
|
|
|
+ cost,
|
|
|
+ buy_reg_num as reg_num,
|
|
|
+ buy_first_new_user_amount_count as first_new_user_amount_count,
|
|
|
+ buy_first_new_user_amount_num as first_new_user_amount_num,
|
|
|
+ buy_first_new_user_amount as first_new_user_amount,
|
|
|
+ buy_old_user_count as old_user_count,
|
|
|
+ buy_old_user_num as old_user_num,
|
|
|
+ buy_old_user_amount as old_user_amount,
|
|
|
+ buy_amount_count as amount_count,
|
|
|
+ buy_amount_num as amount_num,
|
|
|
+ buy_amount as amount,
|
|
|
+ buy_new_user_total_amount_count as new_user_total_amount_count,
|
|
|
+ buy_new_user_total_amount_num as new_user_total_amount_num,
|
|
|
+ buy_new_user_total_amount as new_user_total_amount,
|
|
|
+ buy_total_roi as total_roi,
|
|
|
+ buy_first_roi as first_roi,
|
|
|
+ buy_first_amount_rate as first_amount_rate,
|
|
|
+ buy_today_amount_rate as today_amount_rate,
|
|
|
+ buy_new_user_rate as new_user_rate,
|
|
|
+ buy_first_avg_amount as first_avg_amount,
|
|
|
+ buy_today_avg_amount as today_avg_amount,
|
|
|
+ buy_avg_amount as avg_amount,
|
|
|
+ buy_user_again_rate as user_again_rate,
|
|
|
+ buy_reg_user_arpu as reg_user_arpu,
|
|
|
+ buy_first_amount_arpu as first_amount_arpu,
|
|
|
+ buy_today_amount_arpu as today_amount_arpu,
|
|
|
+ buy_amount_arpu as amount_arpu,
|
|
|
+ buy_reg_cost as reg_cost,
|
|
|
+ buy_first_amount_cost as first_new_user_recharge_cost,
|
|
|
+ buy_total_amount_cost as total_recharge_cost,
|
|
|
+ buy_hundred_user_num as hundred_user_num,
|
|
|
+ buy_hundred_user_num_cost as hundred_user_num_cost,
|
|
|
+ buy_first_role_num as first_role_num,
|
|
|
+ buy_role_num as role_num,
|
|
|
+ buy_new_user_total_role_num as new_user_total_role_num,
|
|
|
+ round(IF(buy_first_role_num > 0, cost / buy_first_role_num, 0), 2) first_role_num_cost,
|
|
|
+ round(IF(buy_role_num > 0, cost / buy_role_num, 0), 2) role_num_cost,
|
|
|
+ round(IF(buy_new_user_total_role_num >0, cost / buy_new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
|
|
|
+ round(IF(buy_reg_num >0, buy_first_role_num / buy_reg_num, 0), 4) first_role_num_rate,
|
|
|
+ round(IF(buy_reg_num >0, buy_role_num / buy_reg_num, 0), 4) role_num_rate,
|
|
|
+ round(IF(buy_reg_num >0, buy_new_user_total_role_num / buy_reg_num, 0), 4) new_user_total_role_num_rate
|
|
|
+ FROM
|
|
|
+ ads_game_day
|
|
|
+ """ + cri +
|
|
|
+ """
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ game_id,
|
|
|
+ dt,
|
|
|
+ buy_user_ltv_1 as user_ltv1,
|
|
|
+ buy_user_ltv_2 as user_ltv2,
|
|
|
+ buy_user_ltv_3 as user_ltv3,
|
|
|
+ buy_user_ltv_4 as user_ltv4,
|
|
|
+ buy_user_ltv_5 as user_ltv5,
|
|
|
+ buy_user_ltv_6 as user_ltv6,
|
|
|
+ buy_user_ltv_7 as user_ltv7,
|
|
|
+ buy_user_ltv_8 as user_ltv8,
|
|
|
+ buy_user_ltv_9 as user_ltv9,
|
|
|
+ buy_user_ltv_10 as user_ltv10,
|
|
|
+ buy_user_ltv_11 as user_ltv11,
|
|
|
+ buy_user_ltv_12 as user_ltv12,
|
|
|
+ buy_user_ltv_13 as user_ltv13,
|
|
|
+ buy_user_ltv_14 as user_ltv14,
|
|
|
+ buy_user_ltv_15 as user_ltv15,
|
|
|
+ buy_user_ltv_16 as user_ltv16,
|
|
|
+ buy_user_ltv_17 as user_ltv17,
|
|
|
+ buy_user_ltv_18 as user_ltv18,
|
|
|
+ buy_user_ltv_19 as user_ltv19,
|
|
|
+ buy_user_ltv_20 as user_ltv20,
|
|
|
+ buy_user_ltv_21 as user_ltv21,
|
|
|
+ buy_user_ltv_22 as user_ltv22,
|
|
|
+ buy_user_ltv_23 as user_ltv23,
|
|
|
+ buy_user_ltv_24 as user_ltv24,
|
|
|
+ buy_user_ltv_25 as user_ltv25,
|
|
|
+ buy_user_ltv_26 as user_ltv26,
|
|
|
+ buy_user_ltv_27 as user_ltv27,
|
|
|
+ buy_user_ltv_28 as user_ltv28,
|
|
|
+ buy_user_ltv_29 as user_ltv29,
|
|
|
+ buy_user_ltv_30 as user_ltv30,
|
|
|
+ buy_user_ltv_31 as user_ltv31,
|
|
|
+ buy_user_ltv_32 as user_ltv32,
|
|
|
+ buy_user_ltv_33 as user_ltv33,
|
|
|
+ buy_user_ltv_34 as user_ltv34,
|
|
|
+ buy_user_ltv_35 as user_ltv35,
|
|
|
+ buy_user_ltv_36 as user_ltv36,
|
|
|
+ buy_user_ltv_37 as user_ltv37,
|
|
|
+ buy_user_ltv_38 as user_ltv38,
|
|
|
+ buy_user_ltv_39 as user_ltv39,
|
|
|
+ buy_user_ltv_40 as user_ltv40,
|
|
|
+ buy_user_ltv_41 as user_ltv41,
|
|
|
+ buy_user_ltv_42 as user_ltv42,
|
|
|
+ buy_user_ltv_43 as user_ltv43,
|
|
|
+ buy_user_ltv_44 as user_ltv44,
|
|
|
+ buy_user_ltv_45 as user_ltv45,
|
|
|
+ buy_user_ltv_46 as user_ltv46,
|
|
|
+ buy_user_ltv_47 as user_ltv47,
|
|
|
+ buy_user_ltv_48 as user_ltv48,
|
|
|
+ buy_user_ltv_49 as user_ltv49,
|
|
|
+ buy_user_ltv_50 as user_ltv50,
|
|
|
+ buy_user_ltv_51 as user_ltv51,
|
|
|
+ buy_user_ltv_52 as user_ltv52,
|
|
|
+ buy_user_ltv_53 as user_ltv53,
|
|
|
+ buy_user_ltv_54 as user_ltv54,
|
|
|
+ buy_user_ltv_55 as user_ltv55,
|
|
|
+ buy_user_ltv_56 as user_ltv56,
|
|
|
+ buy_user_ltv_57 as user_ltv57,
|
|
|
+ buy_user_ltv_58 as user_ltv58,
|
|
|
+ buy_user_ltv_59 as user_ltv59,
|
|
|
+ buy_user_ltv_60 as user_ltv60,
|
|
|
+ buy_user_ltv_61 as user_ltv61,
|
|
|
+ buy_user_ltv_62 as user_ltv62,
|
|
|
+ buy_user_ltv_63 as user_ltv63,
|
|
|
+ buy_user_ltv_64 as user_ltv64,
|
|
|
+ buy_user_ltv_65 as user_ltv65,
|
|
|
+ buy_user_ltv_66 as user_ltv66,
|
|
|
+ buy_user_ltv_67 as user_ltv67,
|
|
|
+ buy_user_ltv_68 as user_ltv68,
|
|
|
+ buy_user_ltv_69 as user_ltv69,
|
|
|
+ buy_user_ltv_70 as user_ltv70,
|
|
|
+ buy_user_ltv_71 as user_ltv71,
|
|
|
+ buy_user_ltv_72 as user_ltv72,
|
|
|
+ buy_user_ltv_73 as user_ltv73,
|
|
|
+ buy_user_ltv_74 as user_ltv74,
|
|
|
+ buy_user_ltv_75 as user_ltv75,
|
|
|
+ buy_user_ltv_76 as user_ltv76,
|
|
|
+ buy_user_ltv_77 as user_ltv77,
|
|
|
+ buy_user_ltv_78 as user_ltv78,
|
|
|
+ buy_user_ltv_79 as user_ltv79,
|
|
|
+ buy_user_ltv_80 as user_ltv80,
|
|
|
+ buy_user_ltv_81 as user_ltv81,
|
|
|
+ buy_user_ltv_82 as user_ltv82,
|
|
|
+ buy_user_ltv_83 as user_ltv83,
|
|
|
+ buy_user_ltv_84 as user_ltv84,
|
|
|
+ buy_user_ltv_85 as user_ltv85,
|
|
|
+ buy_user_ltv_86 as user_ltv86,
|
|
|
+ buy_user_ltv_87 as user_ltv87,
|
|
|
+ buy_user_ltv_88 as user_ltv88,
|
|
|
+ buy_user_ltv_89 as user_ltv89,
|
|
|
+ buy_user_ltv_90 as user_ltv90,
|
|
|
+ buy_user_ltv_m4 as user_ltv_m4,
|
|
|
+ buy_user_ltv_m5 as user_ltv_m5,
|
|
|
+ buy_user_ltv_m6 as user_ltv_m6,
|
|
|
+ buy_user_ltv_m7 as user_ltv_m7,
|
|
|
+ buy_user_ltv_m8 as user_ltv_m8,
|
|
|
+ buy_user_ltv_m9 as user_ltv_m9,
|
|
|
+ buy_user_ltv_m10 as user_ltv_m10,
|
|
|
+ buy_user_ltv_m11 as user_ltv_m11,
|
|
|
+ buy_user_ltv_y1 as user_ltv_y1,
|
|
|
+ buy_user_ltv_total as user_ltv_total,
|
|
|
+ buy_role_ltv_1 as role_ltv1,
|
|
|
+ buy_role_ltv_2 as role_ltv2,
|
|
|
+ buy_role_ltv_3 as role_ltv3,
|
|
|
+ buy_role_ltv_4 as role_ltv4,
|
|
|
+ buy_role_ltv_5 as role_ltv5,
|
|
|
+ buy_role_ltv_6 as role_ltv6,
|
|
|
+ buy_role_ltv_7 as role_ltv7,
|
|
|
+ buy_role_ltv_8 as role_ltv8,
|
|
|
+ buy_role_ltv_9 as role_ltv9,
|
|
|
+ buy_role_ltv_10 as role_ltv10,
|
|
|
+ buy_role_ltv_11 as role_ltv11,
|
|
|
+ buy_role_ltv_12 as role_ltv12,
|
|
|
+ buy_role_ltv_13 as role_ltv13,
|
|
|
+ buy_role_ltv_14 as role_ltv14,
|
|
|
+ buy_role_ltv_15 as role_ltv15,
|
|
|
+ buy_role_ltv_16 as role_ltv16,
|
|
|
+ buy_role_ltv_17 as role_ltv17,
|
|
|
+ buy_role_ltv_18 as role_ltv18,
|
|
|
+ buy_role_ltv_19 as role_ltv19,
|
|
|
+ buy_role_ltv_20 as role_ltv20,
|
|
|
+ buy_role_ltv_21 as role_ltv21,
|
|
|
+ buy_role_ltv_22 as role_ltv22,
|
|
|
+ buy_role_ltv_23 as role_ltv23,
|
|
|
+ buy_role_ltv_24 as role_ltv24,
|
|
|
+ buy_role_ltv_25 as role_ltv25,
|
|
|
+ buy_role_ltv_26 as role_ltv26,
|
|
|
+ buy_role_ltv_27 as role_ltv27,
|
|
|
+ buy_role_ltv_28 as role_ltv28,
|
|
|
+ buy_role_ltv_29 as role_ltv29,
|
|
|
+ buy_role_ltv_30 as role_ltv30,
|
|
|
+ buy_role_ltv_31 as role_ltv31,
|
|
|
+ buy_role_ltv_32 as role_ltv32,
|
|
|
+ buy_role_ltv_33 as role_ltv33,
|
|
|
+ buy_role_ltv_34 as role_ltv34,
|
|
|
+ buy_role_ltv_35 as role_ltv35,
|
|
|
+ buy_role_ltv_36 as role_ltv36,
|
|
|
+ buy_role_ltv_37 as role_ltv37,
|
|
|
+ buy_role_ltv_38 as role_ltv38,
|
|
|
+ buy_role_ltv_39 as role_ltv39,
|
|
|
+ buy_role_ltv_40 as role_ltv40,
|
|
|
+ buy_role_ltv_41 as role_ltv41,
|
|
|
+ buy_role_ltv_42 as role_ltv42,
|
|
|
+ buy_role_ltv_43 as role_ltv43,
|
|
|
+ buy_role_ltv_44 as role_ltv44,
|
|
|
+ buy_role_ltv_45 as role_ltv45,
|
|
|
+ buy_role_ltv_46 as role_ltv46,
|
|
|
+ buy_role_ltv_47 as role_ltv47,
|
|
|
+ buy_role_ltv_48 as role_ltv48,
|
|
|
+ buy_role_ltv_49 as role_ltv49,
|
|
|
+ buy_role_ltv_50 as role_ltv50,
|
|
|
+ buy_role_ltv_51 as role_ltv51,
|
|
|
+ buy_role_ltv_52 as role_ltv52,
|
|
|
+ buy_role_ltv_53 as role_ltv53,
|
|
|
+ buy_role_ltv_54 as role_ltv54,
|
|
|
+ buy_role_ltv_55 as role_ltv55,
|
|
|
+ buy_role_ltv_56 as role_ltv56,
|
|
|
+ buy_role_ltv_57 as role_ltv57,
|
|
|
+ buy_role_ltv_58 as role_ltv58,
|
|
|
+ buy_role_ltv_59 as role_ltv59,
|
|
|
+ buy_role_ltv_60 as role_ltv60,
|
|
|
+ buy_role_ltv_61 as role_ltv61,
|
|
|
+ buy_role_ltv_62 as role_ltv62,
|
|
|
+ buy_role_ltv_63 as role_ltv63,
|
|
|
+ buy_role_ltv_64 as role_ltv64,
|
|
|
+ buy_role_ltv_65 as role_ltv65,
|
|
|
+ buy_role_ltv_66 as role_ltv66,
|
|
|
+ buy_role_ltv_67 as role_ltv67,
|
|
|
+ buy_role_ltv_68 as role_ltv68,
|
|
|
+ buy_role_ltv_69 as role_ltv69,
|
|
|
+ buy_role_ltv_70 as role_ltv70,
|
|
|
+ buy_role_ltv_71 as role_ltv71,
|
|
|
+ buy_role_ltv_72 as role_ltv72,
|
|
|
+ buy_role_ltv_73 as role_ltv73,
|
|
|
+ buy_role_ltv_74 as role_ltv74,
|
|
|
+ buy_role_ltv_75 as role_ltv75,
|
|
|
+ buy_role_ltv_76 as role_ltv76,
|
|
|
+ buy_role_ltv_77 as role_ltv77,
|
|
|
+ buy_role_ltv_78 as role_ltv78,
|
|
|
+ buy_role_ltv_79 as role_ltv79,
|
|
|
+ buy_role_ltv_80 as role_ltv80,
|
|
|
+ buy_role_ltv_81 as role_ltv81,
|
|
|
+ buy_role_ltv_82 as role_ltv82,
|
|
|
+ buy_role_ltv_83 as role_ltv83,
|
|
|
+ buy_role_ltv_84 as role_ltv84,
|
|
|
+ buy_role_ltv_85 as role_ltv85,
|
|
|
+ buy_role_ltv_86 as role_ltv86,
|
|
|
+ buy_role_ltv_87 as role_ltv87,
|
|
|
+ buy_role_ltv_88 as role_ltv88,
|
|
|
+ buy_role_ltv_89 as role_ltv89,
|
|
|
+ buy_role_ltv_90 as role_ltv90,
|
|
|
+ buy_role_ltv_m4 as role_ltv_m4,
|
|
|
+ buy_role_ltv_m5 as role_ltv_m5,
|
|
|
+ buy_role_ltv_m6 as role_ltv_m6,
|
|
|
+ buy_role_ltv_m7 as role_ltv_m7,
|
|
|
+ buy_role_ltv_m8 as role_ltv_m8,
|
|
|
+ buy_role_ltv_m9 as role_ltv_m9,
|
|
|
+ buy_role_ltv_m10 as role_ltv_m10,
|
|
|
+ buy_role_ltv_m11 as role_ltv_m11,
|
|
|
+ buy_role_ltv_y1 as role_ltv_y1,
|
|
|
+ buy_role_ltv_total as role_ltv_total,
|
|
|
+ buy_da1 as da1,
|
|
|
+ buy_da2 as da2,
|
|
|
+ buy_da3 as da3,
|
|
|
+ buy_da4 as da4,
|
|
|
+ buy_da5 as da5,
|
|
|
+ buy_da6 as da6,
|
|
|
+ buy_da7 as da7,
|
|
|
+ buy_da8 as da8,
|
|
|
+ buy_da9 as da9,
|
|
|
+ buy_da10 as da10,
|
|
|
+ buy_da11 as da11,
|
|
|
+ buy_da12 as da12,
|
|
|
+ buy_da13 as da13,
|
|
|
+ buy_da14 as da14,
|
|
|
+ buy_da15 as da15,
|
|
|
+ buy_da16 as da16,
|
|
|
+ buy_da17 as da17,
|
|
|
+ buy_da18 as da18,
|
|
|
+ buy_da19 as da19,
|
|
|
+ buy_da20 as da20,
|
|
|
+ buy_da21 as da21,
|
|
|
+ buy_da22 as da22,
|
|
|
+ buy_da23 as da23,
|
|
|
+ buy_da24 as da24,
|
|
|
+ buy_da25 as da25,
|
|
|
+ buy_da26 as da26,
|
|
|
+ buy_da27 as da27,
|
|
|
+ buy_da28 as da28,
|
|
|
+ buy_da29 as da29,
|
|
|
+ buy_da30 as da30,
|
|
|
+ buy_da31 as da31,
|
|
|
+ buy_da32 as da32,
|
|
|
+ buy_da33 as da33,
|
|
|
+ buy_da34 as da34,
|
|
|
+ buy_da35 as da35,
|
|
|
+ buy_da36 as da36,
|
|
|
+ buy_da37 as da37,
|
|
|
+ buy_da38 as da38,
|
|
|
+ buy_da39 as da39,
|
|
|
+ buy_da40 as da40,
|
|
|
+ buy_da41 as da41,
|
|
|
+ buy_da42 as da42,
|
|
|
+ buy_da43 as da43,
|
|
|
+ buy_da44 as da44,
|
|
|
+ buy_da45 as da45,
|
|
|
+ buy_da46 as da46,
|
|
|
+ buy_da47 as da47,
|
|
|
+ buy_da48 as da48,
|
|
|
+ buy_da49 as da49,
|
|
|
+ buy_da50 as da50,
|
|
|
+ buy_da51 as da51,
|
|
|
+ buy_da52 as da52,
|
|
|
+ buy_da53 as da53,
|
|
|
+ buy_da54 as da54,
|
|
|
+ buy_da55 as da55,
|
|
|
+ buy_da56 as da56,
|
|
|
+ buy_da57 as da57,
|
|
|
+ buy_da58 as da58,
|
|
|
+ buy_da59 as da59,
|
|
|
+ buy_da60 as da60,
|
|
|
+ buy_da61 as da61,
|
|
|
+ buy_da62 as da62,
|
|
|
+ buy_da63 as da63,
|
|
|
+ buy_da64 as da64,
|
|
|
+ buy_da65 as da65,
|
|
|
+ buy_da66 as da66,
|
|
|
+ buy_da67 as da67,
|
|
|
+ buy_da68 as da68,
|
|
|
+ buy_da69 as da69,
|
|
|
+ buy_da70 as da70,
|
|
|
+ buy_da71 as da71,
|
|
|
+ buy_da72 as da72,
|
|
|
+ buy_da73 as da73,
|
|
|
+ buy_da74 as da74,
|
|
|
+ buy_da75 as da75,
|
|
|
+ buy_da76 as da76,
|
|
|
+ buy_da77 as da77,
|
|
|
+ buy_da78 as da78,
|
|
|
+ buy_da79 as da79,
|
|
|
+ buy_da80 as da80,
|
|
|
+ buy_da81 as da81,
|
|
|
+ buy_da82 as da82,
|
|
|
+ buy_da83 as da83,
|
|
|
+ buy_da84 as da84,
|
|
|
+ buy_da85 as da85,
|
|
|
+ buy_da86 as da86,
|
|
|
+ buy_da87 as da87,
|
|
|
+ buy_da88 as da88,
|
|
|
+ buy_da89 as da89,
|
|
|
+ buy_da90 as da90,
|
|
|
+ buy_m4 as m4,
|
|
|
+ buy_m5 as m5,
|
|
|
+ buy_m6 as m6,
|
|
|
+ buy_m7 as m7,
|
|
|
+ buy_m8 as m8,
|
|
|
+ buy_m9 as m9,
|
|
|
+ buy_m10 as m10,
|
|
|
+ buy_m11 as m11,
|
|
|
+ buy_y1 as y1,
|
|
|
+ buy_total as total,
|
|
|
+ buy_first_role_num as first_role_num_ltv,
|
|
|
+ buy_reg_user_cnt as reg_user_cnt
|
|
|
+ FROM
|
|
|
+ ads_user_role_ltv_trend
|
|
|
+ """ + cri +
|
|
|
+ """
|
|
|
+ ) b
|
|
|
+ ON a.game_id = b.game_id and a.cost_date = b.dt
|
|
|
+ """;
|
|
|
+ } else if ("nature".equals(type)) {
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ a.*,
|
|
|
+ b.*
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ dt cost_date,
|
|
|
+ game_name,
|
|
|
+ game_id,
|
|
|
+ game_classify,
|
|
|
+ source_system,
|
|
|
+ cost,
|
|
|
+ nature_reg_num as reg_num,
|
|
|
+ nature_first_new_user_amount_count as first_new_user_amount_count,
|
|
|
+ nature_first_new_user_amount_num as first_new_user_amount_num,
|
|
|
+ nature_first_new_user_amount as first_new_user_amount,
|
|
|
+ nature_old_user_count as old_user_count,
|
|
|
+ nature_old_user_num as old_user_num,
|
|
|
+ nature_old_user_amount as old_user_amount,
|
|
|
+ nature_amount_count as amount_count,
|
|
|
+ nature_amount_num as amount_num,
|
|
|
+ nature_amount as amount,
|
|
|
+ nature_new_user_total_amount_count as new_user_total_amount_count,
|
|
|
+ nature_new_user_total_amount_num as new_user_total_amount_num,
|
|
|
+ nature_new_user_total_amount as new_user_total_amount,
|
|
|
+ nature_total_roi as total_roi,
|
|
|
+ nature_first_roi as first_roi,
|
|
|
+ nature_first_amount_rate as first_amount_rate,
|
|
|
+ nature_today_amount_rate as today_amount_rate,
|
|
|
+ nature_new_user_rate as new_user_rate,
|
|
|
+ nature_first_avg_amount as first_avg_amount,
|
|
|
+ nature_today_avg_amount as today_avg_amount,
|
|
|
+ nature_avg_amount as avg_amount,
|
|
|
+ nature_user_again_rate as user_again_rate,
|
|
|
+ nature_reg_user_arpu as reg_user_arpu,
|
|
|
+ nature_first_amount_arpu as first_amount_arpu,
|
|
|
+ nature_today_amount_arpu as today_amount_arpu,
|
|
|
+ nature_amount_arpu as amount_arpu,
|
|
|
+ nature_reg_cost as reg_cost,
|
|
|
+ nature_first_amount_cost as first_new_user_recharge_cost,
|
|
|
+ nature_total_amount_cost as total_recharge_cost,
|
|
|
+ nature_hundred_user_num as hundred_user_num,
|
|
|
+ nature_hundred_user_num_cost as hundred_user_num_cost,
|
|
|
+ nature_first_role_num as first_role_num,
|
|
|
+ nature_role_num as role_num,
|
|
|
+ nature_new_user_total_role_num as new_user_total_role_num,
|
|
|
+ round(IF(nature_first_role_num > 0, cost / nature_first_role_num, 0), 2) first_role_num_cost,
|
|
|
+ round(IF(nature_role_num > 0, cost / nature_role_num, 0), 2) role_num_cost,
|
|
|
+ round(IF(nature_new_user_total_role_num >0, cost / nature_new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
|
|
|
+ round(IF(nature_reg_num >0, nature_first_role_num / nature_reg_num, 0), 4) first_role_num_rate,
|
|
|
+ round(IF(nature_reg_num >0, nature_role_num / nature_reg_num, 0), 4) role_num_rate,
|
|
|
+ round(IF(nature_reg_num >0, nature_new_user_total_role_num / nature_reg_num, 0), 4) new_user_total_role_num_rate
|
|
|
+ FROM
|
|
|
+ ads_game_day
|
|
|
+ """ + cri +
|
|
|
+ """
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ game_id,
|
|
|
+ dt,
|
|
|
+ nature_user_ltv_1 as user_ltv1,
|
|
|
+ nature_user_ltv_2 as user_ltv2,
|
|
|
+ nature_user_ltv_3 as user_ltv3,
|
|
|
+ nature_user_ltv_4 as user_ltv4,
|
|
|
+ nature_user_ltv_5 as user_ltv5,
|
|
|
+ nature_user_ltv_6 as user_ltv6,
|
|
|
+ nature_user_ltv_7 as user_ltv7,
|
|
|
+ nature_user_ltv_8 as user_ltv8,
|
|
|
+ nature_user_ltv_9 as user_ltv9,
|
|
|
+ nature_user_ltv_10 as user_ltv10,
|
|
|
+ nature_user_ltv_11 as user_ltv11,
|
|
|
+ nature_user_ltv_12 as user_ltv12,
|
|
|
+ nature_user_ltv_13 as user_ltv13,
|
|
|
+ nature_user_ltv_14 as user_ltv14,
|
|
|
+ nature_user_ltv_15 as user_ltv15,
|
|
|
+ nature_user_ltv_16 as user_ltv16,
|
|
|
+ nature_user_ltv_17 as user_ltv17,
|
|
|
+ nature_user_ltv_18 as user_ltv18,
|
|
|
+ nature_user_ltv_19 as user_ltv19,
|
|
|
+ nature_user_ltv_20 as user_ltv20,
|
|
|
+ nature_user_ltv_21 as user_ltv21,
|
|
|
+ nature_user_ltv_22 as user_ltv22,
|
|
|
+ nature_user_ltv_23 as user_ltv23,
|
|
|
+ nature_user_ltv_24 as user_ltv24,
|
|
|
+ nature_user_ltv_25 as user_ltv25,
|
|
|
+ nature_user_ltv_26 as user_ltv26,
|
|
|
+ nature_user_ltv_27 as user_ltv27,
|
|
|
+ nature_user_ltv_28 as user_ltv28,
|
|
|
+ nature_user_ltv_29 as user_ltv29,
|
|
|
+ nature_user_ltv_30 as user_ltv30,
|
|
|
+ nature_user_ltv_31 as user_ltv31,
|
|
|
+ nature_user_ltv_32 as user_ltv32,
|
|
|
+ nature_user_ltv_33 as user_ltv33,
|
|
|
+ nature_user_ltv_34 as user_ltv34,
|
|
|
+ nature_user_ltv_35 as user_ltv35,
|
|
|
+ nature_user_ltv_36 as user_ltv36,
|
|
|
+ nature_user_ltv_37 as user_ltv37,
|
|
|
+ nature_user_ltv_38 as user_ltv38,
|
|
|
+ nature_user_ltv_39 as user_ltv39,
|
|
|
+ nature_user_ltv_40 as user_ltv40,
|
|
|
+ nature_user_ltv_41 as user_ltv41,
|
|
|
+ nature_user_ltv_42 as user_ltv42,
|
|
|
+ nature_user_ltv_43 as user_ltv43,
|
|
|
+ nature_user_ltv_44 as user_ltv44,
|
|
|
+ nature_user_ltv_45 as user_ltv45,
|
|
|
+ nature_user_ltv_46 as user_ltv46,
|
|
|
+ nature_user_ltv_47 as user_ltv47,
|
|
|
+ nature_user_ltv_48 as user_ltv48,
|
|
|
+ nature_user_ltv_49 as user_ltv49,
|
|
|
+ nature_user_ltv_50 as user_ltv50,
|
|
|
+ nature_user_ltv_51 as user_ltv51,
|
|
|
+ nature_user_ltv_52 as user_ltv52,
|
|
|
+ nature_user_ltv_53 as user_ltv53,
|
|
|
+ nature_user_ltv_54 as user_ltv54,
|
|
|
+ nature_user_ltv_55 as user_ltv55,
|
|
|
+ nature_user_ltv_56 as user_ltv56,
|
|
|
+ nature_user_ltv_57 as user_ltv57,
|
|
|
+ nature_user_ltv_58 as user_ltv58,
|
|
|
+ nature_user_ltv_59 as user_ltv59,
|
|
|
+ nature_user_ltv_60 as user_ltv60,
|
|
|
+ nature_user_ltv_61 as user_ltv61,
|
|
|
+ nature_user_ltv_62 as user_ltv62,
|
|
|
+ nature_user_ltv_63 as user_ltv63,
|
|
|
+ nature_user_ltv_64 as user_ltv64,
|
|
|
+ nature_user_ltv_65 as user_ltv65,
|
|
|
+ nature_user_ltv_66 as user_ltv66,
|
|
|
+ nature_user_ltv_67 as user_ltv67,
|
|
|
+ nature_user_ltv_68 as user_ltv68,
|
|
|
+ nature_user_ltv_69 as user_ltv69,
|
|
|
+ nature_user_ltv_70 as user_ltv70,
|
|
|
+ nature_user_ltv_71 as user_ltv71,
|
|
|
+ nature_user_ltv_72 as user_ltv72,
|
|
|
+ nature_user_ltv_73 as user_ltv73,
|
|
|
+ nature_user_ltv_74 as user_ltv74,
|
|
|
+ nature_user_ltv_75 as user_ltv75,
|
|
|
+ nature_user_ltv_76 as user_ltv76,
|
|
|
+ nature_user_ltv_77 as user_ltv77,
|
|
|
+ nature_user_ltv_78 as user_ltv78,
|
|
|
+ nature_user_ltv_79 as user_ltv79,
|
|
|
+ nature_user_ltv_80 as user_ltv80,
|
|
|
+ nature_user_ltv_81 as user_ltv81,
|
|
|
+ nature_user_ltv_82 as user_ltv82,
|
|
|
+ nature_user_ltv_83 as user_ltv83,
|
|
|
+ nature_user_ltv_84 as user_ltv84,
|
|
|
+ nature_user_ltv_85 as user_ltv85,
|
|
|
+ nature_user_ltv_86 as user_ltv86,
|
|
|
+ nature_user_ltv_87 as user_ltv87,
|
|
|
+ nature_user_ltv_88 as user_ltv88,
|
|
|
+ nature_user_ltv_89 as user_ltv89,
|
|
|
+ nature_user_ltv_90 as user_ltv90,
|
|
|
+ nature_user_ltv_m4 as user_ltv_m4,
|
|
|
+ nature_user_ltv_m5 as user_ltv_m5,
|
|
|
+ nature_user_ltv_m6 as user_ltv_m6,
|
|
|
+ nature_user_ltv_m7 as user_ltv_m7,
|
|
|
+ nature_user_ltv_m8 as user_ltv_m8,
|
|
|
+ nature_user_ltv_m9 as user_ltv_m9,
|
|
|
+ nature_user_ltv_m10 as user_ltv_m10,
|
|
|
+ nature_user_ltv_m11 as user_ltv_m11,
|
|
|
+ nature_user_ltv_y1 as user_ltv_y1,
|
|
|
+ nature_user_ltv_total as user_ltv_total,
|
|
|
+ nature_role_ltv_1 as role_ltv1,
|
|
|
+ nature_role_ltv_2 as role_ltv2,
|
|
|
+ nature_role_ltv_3 as role_ltv3,
|
|
|
+ nature_role_ltv_4 as role_ltv4,
|
|
|
+ nature_role_ltv_5 as role_ltv5,
|
|
|
+ nature_role_ltv_6 as role_ltv6,
|
|
|
+ nature_role_ltv_7 as role_ltv7,
|
|
|
+ nature_role_ltv_8 as role_ltv8,
|
|
|
+ nature_role_ltv_9 as role_ltv9,
|
|
|
+ nature_role_ltv_10 as role_ltv10,
|
|
|
+ nature_role_ltv_11 as role_ltv11,
|
|
|
+ nature_role_ltv_12 as role_ltv12,
|
|
|
+ nature_role_ltv_13 as role_ltv13,
|
|
|
+ nature_role_ltv_14 as role_ltv14,
|
|
|
+ nature_role_ltv_15 as role_ltv15,
|
|
|
+ nature_role_ltv_16 as role_ltv16,
|
|
|
+ nature_role_ltv_17 as role_ltv17,
|
|
|
+ nature_role_ltv_18 as role_ltv18,
|
|
|
+ nature_role_ltv_19 as role_ltv19,
|
|
|
+ nature_role_ltv_20 as role_ltv20,
|
|
|
+ nature_role_ltv_21 as role_ltv21,
|
|
|
+ nature_role_ltv_22 as role_ltv22,
|
|
|
+ nature_role_ltv_23 as role_ltv23,
|
|
|
+ nature_role_ltv_24 as role_ltv24,
|
|
|
+ nature_role_ltv_25 as role_ltv25,
|
|
|
+ nature_role_ltv_26 as role_ltv26,
|
|
|
+ nature_role_ltv_27 as role_ltv27,
|
|
|
+ nature_role_ltv_28 as role_ltv28,
|
|
|
+ nature_role_ltv_29 as role_ltv29,
|
|
|
+ nature_role_ltv_30 as role_ltv30,
|
|
|
+ nature_role_ltv_31 as role_ltv31,
|
|
|
+ nature_role_ltv_32 as role_ltv32,
|
|
|
+ nature_role_ltv_33 as role_ltv33,
|
|
|
+ nature_role_ltv_34 as role_ltv34,
|
|
|
+ nature_role_ltv_35 as role_ltv35,
|
|
|
+ nature_role_ltv_36 as role_ltv36,
|
|
|
+ nature_role_ltv_37 as role_ltv37,
|
|
|
+ nature_role_ltv_38 as role_ltv38,
|
|
|
+ nature_role_ltv_39 as role_ltv39,
|
|
|
+ nature_role_ltv_40 as role_ltv40,
|
|
|
+ nature_role_ltv_41 as role_ltv41,
|
|
|
+ nature_role_ltv_42 as role_ltv42,
|
|
|
+ nature_role_ltv_43 as role_ltv43,
|
|
|
+ nature_role_ltv_44 as role_ltv44,
|
|
|
+ nature_role_ltv_45 as role_ltv45,
|
|
|
+ nature_role_ltv_46 as role_ltv46,
|
|
|
+ nature_role_ltv_47 as role_ltv47,
|
|
|
+ nature_role_ltv_48 as role_ltv48,
|
|
|
+ nature_role_ltv_49 as role_ltv49,
|
|
|
+ nature_role_ltv_50 as role_ltv50,
|
|
|
+ nature_role_ltv_51 as role_ltv51,
|
|
|
+ nature_role_ltv_52 as role_ltv52,
|
|
|
+ nature_role_ltv_53 as role_ltv53,
|
|
|
+ nature_role_ltv_54 as role_ltv54,
|
|
|
+ nature_role_ltv_55 as role_ltv55,
|
|
|
+ nature_role_ltv_56 as role_ltv56,
|
|
|
+ nature_role_ltv_57 as role_ltv57,
|
|
|
+ nature_role_ltv_58 as role_ltv58,
|
|
|
+ nature_role_ltv_59 as role_ltv59,
|
|
|
+ nature_role_ltv_60 as role_ltv60,
|
|
|
+ nature_role_ltv_61 as role_ltv61,
|
|
|
+ nature_role_ltv_62 as role_ltv62,
|
|
|
+ nature_role_ltv_63 as role_ltv63,
|
|
|
+ nature_role_ltv_64 as role_ltv64,
|
|
|
+ nature_role_ltv_65 as role_ltv65,
|
|
|
+ nature_role_ltv_66 as role_ltv66,
|
|
|
+ nature_role_ltv_67 as role_ltv67,
|
|
|
+ nature_role_ltv_68 as role_ltv68,
|
|
|
+ nature_role_ltv_69 as role_ltv69,
|
|
|
+ nature_role_ltv_70 as role_ltv70,
|
|
|
+ nature_role_ltv_71 as role_ltv71,
|
|
|
+ nature_role_ltv_72 as role_ltv72,
|
|
|
+ nature_role_ltv_73 as role_ltv73,
|
|
|
+ nature_role_ltv_74 as role_ltv74,
|
|
|
+ nature_role_ltv_75 as role_ltv75,
|
|
|
+ nature_role_ltv_76 as role_ltv76,
|
|
|
+ nature_role_ltv_77 as role_ltv77,
|
|
|
+ nature_role_ltv_78 as role_ltv78,
|
|
|
+ nature_role_ltv_79 as role_ltv79,
|
|
|
+ nature_role_ltv_80 as role_ltv80,
|
|
|
+ nature_role_ltv_81 as role_ltv81,
|
|
|
+ nature_role_ltv_82 as role_ltv82,
|
|
|
+ nature_role_ltv_83 as role_ltv83,
|
|
|
+ nature_role_ltv_84 as role_ltv84,
|
|
|
+ nature_role_ltv_85 as role_ltv85,
|
|
|
+ nature_role_ltv_86 as role_ltv86,
|
|
|
+ nature_role_ltv_87 as role_ltv87,
|
|
|
+ nature_role_ltv_88 as role_ltv88,
|
|
|
+ nature_role_ltv_89 as role_ltv89,
|
|
|
+ nature_role_ltv_90 as role_ltv90,
|
|
|
+ nature_role_ltv_m4 as role_ltv_m4,
|
|
|
+ nature_role_ltv_m5 as role_ltv_m5,
|
|
|
+ nature_role_ltv_m6 as role_ltv_m6,
|
|
|
+ nature_role_ltv_m7 as role_ltv_m7,
|
|
|
+ nature_role_ltv_m8 as role_ltv_m8,
|
|
|
+ nature_role_ltv_m9 as role_ltv_m9,
|
|
|
+ nature_role_ltv_m10 as role_ltv_m10,
|
|
|
+ nature_role_ltv_m11 as role_ltv_m11,
|
|
|
+ nature_role_ltv_y1 as role_ltv_y1,
|
|
|
+ nature_role_ltv_total as role_ltv_total,
|
|
|
+ nature_da1 as da1,
|
|
|
+ nature_da2 as da2,
|
|
|
+ nature_da3 as da3,
|
|
|
+ nature_da4 as da4,
|
|
|
+ nature_da5 as da5,
|
|
|
+ nature_da6 as da6,
|
|
|
+ nature_da7 as da7,
|
|
|
+ nature_da8 as da8,
|
|
|
+ nature_da9 as da9,
|
|
|
+ nature_da10 as da10,
|
|
|
+ nature_da11 as da11,
|
|
|
+ nature_da12 as da12,
|
|
|
+ nature_da13 as da13,
|
|
|
+ nature_da14 as da14,
|
|
|
+ nature_da15 as da15,
|
|
|
+ nature_da16 as da16,
|
|
|
+ nature_da17 as da17,
|
|
|
+ nature_da18 as da18,
|
|
|
+ nature_da19 as da19,
|
|
|
+ nature_da20 as da20,
|
|
|
+ nature_da21 as da21,
|
|
|
+ nature_da22 as da22,
|
|
|
+ nature_da23 as da23,
|
|
|
+ nature_da24 as da24,
|
|
|
+ nature_da25 as da25,
|
|
|
+ nature_da26 as da26,
|
|
|
+ nature_da27 as da27,
|
|
|
+ nature_da28 as da28,
|
|
|
+ nature_da29 as da29,
|
|
|
+ nature_da30 as da30,
|
|
|
+ nature_da31 as da31,
|
|
|
+ nature_da32 as da32,
|
|
|
+ nature_da33 as da33,
|
|
|
+ nature_da34 as da34,
|
|
|
+ nature_da35 as da35,
|
|
|
+ nature_da36 as da36,
|
|
|
+ nature_da37 as da37,
|
|
|
+ nature_da38 as da38,
|
|
|
+ nature_da39 as da39,
|
|
|
+ nature_da40 as da40,
|
|
|
+ nature_da41 as da41,
|
|
|
+ nature_da42 as da42,
|
|
|
+ nature_da43 as da43,
|
|
|
+ nature_da44 as da44,
|
|
|
+ nature_da45 as da45,
|
|
|
+ nature_da46 as da46,
|
|
|
+ nature_da47 as da47,
|
|
|
+ nature_da48 as da48,
|
|
|
+ nature_da49 as da49,
|
|
|
+ nature_da50 as da50,
|
|
|
+ nature_da51 as da51,
|
|
|
+ nature_da52 as da52,
|
|
|
+ nature_da53 as da53,
|
|
|
+ nature_da54 as da54,
|
|
|
+ nature_da55 as da55,
|
|
|
+ nature_da56 as da56,
|
|
|
+ nature_da57 as da57,
|
|
|
+ nature_da58 as da58,
|
|
|
+ nature_da59 as da59,
|
|
|
+ nature_da60 as da60,
|
|
|
+ nature_da61 as da61,
|
|
|
+ nature_da62 as da62,
|
|
|
+ nature_da63 as da63,
|
|
|
+ nature_da64 as da64,
|
|
|
+ nature_da65 as da65,
|
|
|
+ nature_da66 as da66,
|
|
|
+ nature_da67 as da67,
|
|
|
+ nature_da68 as da68,
|
|
|
+ nature_da69 as da69,
|
|
|
+ nature_da70 as da70,
|
|
|
+ nature_da71 as da71,
|
|
|
+ nature_da72 as da72,
|
|
|
+ nature_da73 as da73,
|
|
|
+ nature_da74 as da74,
|
|
|
+ nature_da75 as da75,
|
|
|
+ nature_da76 as da76,
|
|
|
+ nature_da77 as da77,
|
|
|
+ nature_da78 as da78,
|
|
|
+ nature_da79 as da79,
|
|
|
+ nature_da80 as da80,
|
|
|
+ nature_da81 as da81,
|
|
|
+ nature_da82 as da82,
|
|
|
+ nature_da83 as da83,
|
|
|
+ nature_da84 as da84,
|
|
|
+ nature_da85 as da85,
|
|
|
+ nature_da86 as da86,
|
|
|
+ nature_da87 as da87,
|
|
|
+ nature_da88 as da88,
|
|
|
+ nature_da89 as da89,
|
|
|
+ nature_da90 as da90,
|
|
|
+ nature_m4 as m4,
|
|
|
+ nature_m5 as m5,
|
|
|
+ nature_m6 as m6,
|
|
|
+ nature_m7 as m7,
|
|
|
+ nature_m8 as m8,
|
|
|
+ nature_m9 as m9,
|
|
|
+ nature_m10 as m10,
|
|
|
+ nature_m11 as m11,
|
|
|
+ nature_y1 as y1,
|
|
|
+ nature_total as total,
|
|
|
+ nature_first_role_num as first_role_num_ltv,
|
|
|
+ nature_reg_user_cnt as reg_user_cnt
|
|
|
+ FROM
|
|
|
+ ads_user_role_ltv_trend
|
|
|
+ """ + cri +
|
|
|
+ """
|
|
|
+ ) b
|
|
|
+ ON a.game_id = b.game_id and a.cost_date = b.dt
|
|
|
+ """;
|
|
|
+ }
|
|
|
+
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ a.*,
|
|
|
+ b.*
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ dt cost_date,
|
|
|
+ game_name,
|
|
|
+ game_id,
|
|
|
+ game_classify,
|
|
|
+ source_system,
|
|
|
+ cost,
|
|
|
+ reg_num,
|
|
|
+ first_new_user_amount_count,
|
|
|
+ first_new_user_amount_num,
|
|
|
+ first_new_user_amount,
|
|
|
+ old_user_count,
|
|
|
+ old_user_num,
|
|
|
+ old_user_amount,
|
|
|
+ amount_count,
|
|
|
+ amount_num,
|
|
|
+ amount,
|
|
|
+ new_user_total_amount_count,
|
|
|
+ new_user_total_amount_num,
|
|
|
+ new_user_total_amount,
|
|
|
+ total_roi,
|
|
|
+ first_roi,
|
|
|
+ first_amount_rate,
|
|
|
+ today_amount_rate,
|
|
|
+ new_user_rate,
|
|
|
+ first_avg_amount,
|
|
|
+ today_avg_amount,
|
|
|
+ avg_amount,
|
|
|
+ user_again_rate,
|
|
|
+ reg_user_arpu,
|
|
|
+ first_amount_arpu,
|
|
|
+ today_amount_arpu,
|
|
|
+ amount_arpu,
|
|
|
+ reg_cost,
|
|
|
+ first_amount_cost as first_new_user_recharge_cost,
|
|
|
+ total_amount_cost as total_recharge_cost,
|
|
|
+ hundred_user_num,
|
|
|
+ hundred_user_num_cost,
|
|
|
+ first_role_num,
|
|
|
+ role_num,
|
|
|
+ new_user_total_role_num,
|
|
|
+ round(IF(first_role_num > 0, cost / first_role_num, 0), 2) first_role_num_cost,
|
|
|
+ round(IF(role_num > 0, cost / role_num, 0), 2) role_num_cost,
|
|
|
+ round(IF(new_user_total_role_num >0, cost / new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
|
|
|
+ round(IF(reg_num >0, first_role_num / reg_num, 0), 4) first_role_num_rate,
|
|
|
+ round(IF(reg_num >0, role_num / reg_num, 0), 4) role_num_rate,
|
|
|
+ round(IF(reg_num >0, new_user_total_role_num / reg_num, 0), 4) new_user_total_role_num_rate
|
|
|
+ FROM
|
|
|
+ ads_game_day
|
|
|
+ """ + cri +
|
|
|
+ """
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ game_id,
|
|
|
+ dt,
|
|
|
+ user_ltv_1 as user_ltv1,
|
|
|
+ user_ltv_2 as user_ltv2,
|
|
|
+ user_ltv_3 as user_ltv3,
|
|
|
+ user_ltv_4 as user_ltv4,
|
|
|
+ user_ltv_5 as user_ltv5,
|
|
|
+ user_ltv_6 as user_ltv6,
|
|
|
+ user_ltv_7 as user_ltv7,
|
|
|
+ user_ltv_8 as user_ltv8,
|
|
|
+ user_ltv_9 as user_ltv9,
|
|
|
+ user_ltv_10 as user_ltv10,
|
|
|
+ user_ltv_11 as user_ltv11,
|
|
|
+ user_ltv_12 as user_ltv12,
|
|
|
+ user_ltv_13 as user_ltv13,
|
|
|
+ user_ltv_14 as user_ltv14,
|
|
|
+ user_ltv_15 as user_ltv15,
|
|
|
+ user_ltv_16 as user_ltv16,
|
|
|
+ user_ltv_17 as user_ltv17,
|
|
|
+ user_ltv_18 as user_ltv18,
|
|
|
+ user_ltv_19 as user_ltv19,
|
|
|
+ user_ltv_20 as user_ltv20,
|
|
|
+ user_ltv_21 as user_ltv21,
|
|
|
+ user_ltv_22 as user_ltv22,
|
|
|
+ user_ltv_23 as user_ltv23,
|
|
|
+ user_ltv_24 as user_ltv24,
|
|
|
+ user_ltv_25 as user_ltv25,
|
|
|
+ user_ltv_26 as user_ltv26,
|
|
|
+ user_ltv_27 as user_ltv27,
|
|
|
+ user_ltv_28 as user_ltv28,
|
|
|
+ user_ltv_29 as user_ltv29,
|
|
|
+ user_ltv_30 as user_ltv30,
|
|
|
+ user_ltv_31 as user_ltv31,
|
|
|
+ user_ltv_32 as user_ltv32,
|
|
|
+ user_ltv_33 as user_ltv33,
|
|
|
+ user_ltv_34 as user_ltv34,
|
|
|
+ user_ltv_35 as user_ltv35,
|
|
|
+ user_ltv_36 as user_ltv36,
|
|
|
+ user_ltv_37 as user_ltv37,
|
|
|
+ user_ltv_38 as user_ltv38,
|
|
|
+ user_ltv_39 as user_ltv39,
|
|
|
+ user_ltv_40 as user_ltv40,
|
|
|
+ user_ltv_41 as user_ltv41,
|
|
|
+ user_ltv_42 as user_ltv42,
|
|
|
+ user_ltv_43 as user_ltv43,
|
|
|
+ user_ltv_44 as user_ltv44,
|
|
|
+ user_ltv_45 as user_ltv45,
|
|
|
+ user_ltv_46 as user_ltv46,
|
|
|
+ user_ltv_47 as user_ltv47,
|
|
|
+ user_ltv_48 as user_ltv48,
|
|
|
+ user_ltv_49 as user_ltv49,
|
|
|
+ user_ltv_50 as user_ltv50,
|
|
|
+ user_ltv_51 as user_ltv51,
|
|
|
+ user_ltv_52 as user_ltv52,
|
|
|
+ user_ltv_53 as user_ltv53,
|
|
|
+ user_ltv_54 as user_ltv54,
|
|
|
+ user_ltv_55 as user_ltv55,
|
|
|
+ user_ltv_56 as user_ltv56,
|
|
|
+ user_ltv_57 as user_ltv57,
|
|
|
+ user_ltv_58 as user_ltv58,
|
|
|
+ user_ltv_59 as user_ltv59,
|
|
|
+ user_ltv_60 as user_ltv60,
|
|
|
+ user_ltv_61 as user_ltv61,
|
|
|
+ user_ltv_62 as user_ltv62,
|
|
|
+ user_ltv_63 as user_ltv63,
|
|
|
+ user_ltv_64 as user_ltv64,
|
|
|
+ user_ltv_65 as user_ltv65,
|
|
|
+ user_ltv_66 as user_ltv66,
|
|
|
+ user_ltv_67 as user_ltv67,
|
|
|
+ user_ltv_68 as user_ltv68,
|
|
|
+ user_ltv_69 as user_ltv69,
|
|
|
+ user_ltv_70 as user_ltv70,
|
|
|
+ user_ltv_71 as user_ltv71,
|
|
|
+ user_ltv_72 as user_ltv72,
|
|
|
+ user_ltv_73 as user_ltv73,
|
|
|
+ user_ltv_74 as user_ltv74,
|
|
|
+ user_ltv_75 as user_ltv75,
|
|
|
+ user_ltv_76 as user_ltv76,
|
|
|
+ user_ltv_77 as user_ltv77,
|
|
|
+ user_ltv_78 as user_ltv78,
|
|
|
+ user_ltv_79 as user_ltv79,
|
|
|
+ user_ltv_80 as user_ltv80,
|
|
|
+ user_ltv_81 as user_ltv81,
|
|
|
+ user_ltv_82 as user_ltv82,
|
|
|
+ user_ltv_83 as user_ltv83,
|
|
|
+ user_ltv_84 as user_ltv84,
|
|
|
+ user_ltv_85 as user_ltv85,
|
|
|
+ user_ltv_86 as user_ltv86,
|
|
|
+ user_ltv_87 as user_ltv87,
|
|
|
+ user_ltv_88 as user_ltv88,
|
|
|
+ user_ltv_89 as user_ltv89,
|
|
|
+ user_ltv_90 as user_ltv90,
|
|
|
+ user_ltv_m4,
|
|
|
+ user_ltv_m5,
|
|
|
+ user_ltv_m6,
|
|
|
+ user_ltv_m7,
|
|
|
+ user_ltv_m8,
|
|
|
+ user_ltv_m9,
|
|
|
+ user_ltv_m10,
|
|
|
+ user_ltv_m11,
|
|
|
+ user_ltv_y1,
|
|
|
+ user_ltv_total,
|
|
|
+ role_ltv_1 as role_ltv1,
|
|
|
+ role_ltv_2 as role_ltv2,
|
|
|
+ role_ltv_3 as role_ltv3,
|
|
|
+ role_ltv_4 as role_ltv4,
|
|
|
+ role_ltv_5 as role_ltv5,
|
|
|
+ role_ltv_6 as role_ltv6,
|
|
|
+ role_ltv_7 as role_ltv7,
|
|
|
+ role_ltv_8 as role_ltv8,
|
|
|
+ role_ltv_9 as role_ltv9,
|
|
|
+ role_ltv_10 as role_ltv10,
|
|
|
+ role_ltv_11 as role_ltv11,
|
|
|
+ role_ltv_12 as role_ltv12,
|
|
|
+ role_ltv_13 as role_ltv13,
|
|
|
+ role_ltv_14 as role_ltv14,
|
|
|
+ role_ltv_15 as role_ltv15,
|
|
|
+ role_ltv_16 as role_ltv16,
|
|
|
+ role_ltv_17 as role_ltv17,
|
|
|
+ role_ltv_18 as role_ltv18,
|
|
|
+ role_ltv_19 as role_ltv19,
|
|
|
+ role_ltv_20 as role_ltv20,
|
|
|
+ role_ltv_21 as role_ltv21,
|
|
|
+ role_ltv_22 as role_ltv22,
|
|
|
+ role_ltv_23 as role_ltv23,
|
|
|
+ role_ltv_24 as role_ltv24,
|
|
|
+ role_ltv_25 as role_ltv25,
|
|
|
+ role_ltv_26 as role_ltv26,
|
|
|
+ role_ltv_27 as role_ltv27,
|
|
|
+ role_ltv_28 as role_ltv28,
|
|
|
+ role_ltv_29 as role_ltv29,
|
|
|
+ role_ltv_30 as role_ltv30,
|
|
|
+ role_ltv_31 as role_ltv31,
|
|
|
+ role_ltv_32 as role_ltv32,
|
|
|
+ role_ltv_33 as role_ltv33,
|
|
|
+ role_ltv_34 as role_ltv34,
|
|
|
+ role_ltv_35 as role_ltv35,
|
|
|
+ role_ltv_36 as role_ltv36,
|
|
|
+ role_ltv_37 as role_ltv37,
|
|
|
+ role_ltv_38 as role_ltv38,
|
|
|
+ role_ltv_39 as role_ltv39,
|
|
|
+ role_ltv_40 as role_ltv40,
|
|
|
+ role_ltv_41 as role_ltv41,
|
|
|
+ role_ltv_42 as role_ltv42,
|
|
|
+ role_ltv_43 as role_ltv43,
|
|
|
+ role_ltv_44 as role_ltv44,
|
|
|
+ role_ltv_45 as role_ltv45,
|
|
|
+ role_ltv_46 as role_ltv46,
|
|
|
+ role_ltv_47 as role_ltv47,
|
|
|
+ role_ltv_48 as role_ltv48,
|
|
|
+ role_ltv_49 as role_ltv49,
|
|
|
+ role_ltv_50 as role_ltv50,
|
|
|
+ role_ltv_51 as role_ltv51,
|
|
|
+ role_ltv_52 as role_ltv52,
|
|
|
+ role_ltv_53 as role_ltv53,
|
|
|
+ role_ltv_54 as role_ltv54,
|
|
|
+ role_ltv_55 as role_ltv55,
|
|
|
+ role_ltv_56 as role_ltv56,
|
|
|
+ role_ltv_57 as role_ltv57,
|
|
|
+ role_ltv_58 as role_ltv58,
|
|
|
+ role_ltv_59 as role_ltv59,
|
|
|
+ role_ltv_60 as role_ltv60,
|
|
|
+ role_ltv_61 as role_ltv61,
|
|
|
+ role_ltv_62 as role_ltv62,
|
|
|
+ role_ltv_63 as role_ltv63,
|
|
|
+ role_ltv_64 as role_ltv64,
|
|
|
+ role_ltv_65 as role_ltv65,
|
|
|
+ role_ltv_66 as role_ltv66,
|
|
|
+ role_ltv_67 as role_ltv67,
|
|
|
+ role_ltv_68 as role_ltv68,
|
|
|
+ role_ltv_69 as role_ltv69,
|
|
|
+ role_ltv_70 as role_ltv70,
|
|
|
+ role_ltv_71 as role_ltv71,
|
|
|
+ role_ltv_72 as role_ltv72,
|
|
|
+ role_ltv_73 as role_ltv73,
|
|
|
+ role_ltv_74 as role_ltv74,
|
|
|
+ role_ltv_75 as role_ltv75,
|
|
|
+ role_ltv_76 as role_ltv76,
|
|
|
+ role_ltv_77 as role_ltv77,
|
|
|
+ role_ltv_78 as role_ltv78,
|
|
|
+ role_ltv_79 as role_ltv79,
|
|
|
+ role_ltv_80 as role_ltv80,
|
|
|
+ role_ltv_81 as role_ltv81,
|
|
|
+ role_ltv_82 as role_ltv82,
|
|
|
+ role_ltv_83 as role_ltv83,
|
|
|
+ role_ltv_84 as role_ltv84,
|
|
|
+ role_ltv_85 as role_ltv85,
|
|
|
+ role_ltv_86 as role_ltv86,
|
|
|
+ role_ltv_87 as role_ltv87,
|
|
|
+ role_ltv_88 as role_ltv88,
|
|
|
+ role_ltv_89 as role_ltv89,
|
|
|
+ role_ltv_90 as role_ltv90,
|
|
|
+ role_ltv_m4,
|
|
|
+ role_ltv_m5,
|
|
|
+ role_ltv_m6,
|
|
|
+ role_ltv_m7,
|
|
|
+ role_ltv_m8,
|
|
|
+ role_ltv_m9,
|
|
|
+ role_ltv_m10,
|
|
|
+ role_ltv_m11,
|
|
|
+ role_ltv_y1,
|
|
|
+ role_ltv_total,
|
|
|
+ da1,
|
|
|
+ da2,
|
|
|
+ da3,
|
|
|
+ da4,
|
|
|
+ da5,
|
|
|
+ da6,
|
|
|
+ da7,
|
|
|
+ da8,
|
|
|
+ da9,
|
|
|
+ da10,
|
|
|
+ da11,
|
|
|
+ da12,
|
|
|
+ da13,
|
|
|
+ da14,
|
|
|
+ da15,
|
|
|
+ da16,
|
|
|
+ da17,
|
|
|
+ da18,
|
|
|
+ da19,
|
|
|
+ da20,
|
|
|
+ da21,
|
|
|
+ da22,
|
|
|
+ da23,
|
|
|
+ da24,
|
|
|
+ da25,
|
|
|
+ da26,
|
|
|
+ da27,
|
|
|
+ da28,
|
|
|
+ da29,
|
|
|
+ da30,
|
|
|
+ da31,
|
|
|
+ da32,
|
|
|
+ da33,
|
|
|
+ da34,
|
|
|
+ da35,
|
|
|
+ da36,
|
|
|
+ da37,
|
|
|
+ da38,
|
|
|
+ da39,
|
|
|
+ da40,
|
|
|
+ da41,
|
|
|
+ da42,
|
|
|
+ da43,
|
|
|
+ da44,
|
|
|
+ da45,
|
|
|
+ da46,
|
|
|
+ da47,
|
|
|
+ da48,
|
|
|
+ da49,
|
|
|
+ da50,
|
|
|
+ da51,
|
|
|
+ da52,
|
|
|
+ da53,
|
|
|
+ da54,
|
|
|
+ da55,
|
|
|
+ da56,
|
|
|
+ da57,
|
|
|
+ da58,
|
|
|
+ da59,
|
|
|
+ da60,
|
|
|
+ da61,
|
|
|
+ da62,
|
|
|
+ da63,
|
|
|
+ da64,
|
|
|
+ da65,
|
|
|
+ da66,
|
|
|
+ da67,
|
|
|
+ da68,
|
|
|
+ da69,
|
|
|
+ da70,
|
|
|
+ da71,
|
|
|
+ da72,
|
|
|
+ da73,
|
|
|
+ da74,
|
|
|
+ da75,
|
|
|
+ da76,
|
|
|
+ da77,
|
|
|
+ da78,
|
|
|
+ da79,
|
|
|
+ da80,
|
|
|
+ da81,
|
|
|
+ da82,
|
|
|
+ da83,
|
|
|
+ da84,
|
|
|
+ da85,
|
|
|
+ da86,
|
|
|
+ da87,
|
|
|
+ da88,
|
|
|
+ da89,
|
|
|
+ da90,
|
|
|
+ m4,
|
|
|
+ m5,
|
|
|
+ m6,
|
|
|
+ m7,
|
|
|
+ m8,
|
|
|
+ m9,
|
|
|
+ m10,
|
|
|
+ m11,
|
|
|
+ y1,
|
|
|
+ total,
|
|
|
+ first_role_num first_role_num_ltv,
|
|
|
+ reg_user_cnt
|
|
|
+ FROM
|
|
|
+ ads_user_role_ltv_trend
|
|
|
+ """ + cri +
|
|
|
+ """
|
|
|
+ ) b
|
|
|
+ ON a.game_id = b.game_id and a.cost_date = b.dt
|
|
|
+ """;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * ltv总计一栏sql(游戏部分)
|
|
|
+ * @param type 查询的类型 buy、nature、total
|
|
|
+ * @return String
|
|
|
+ */
|
|
|
+ private String getLtvDataTotalGameData(String type) {
|
|
|
+ if("buy".equals(type)) {
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
+ IFNULL(SUM(buy_reg_num), 0) reg_num,
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount), 0) first_new_user_amount,
|
|
|
+ IFNULL(SUM(buy_old_user_count), 0) old_user_count,
|
|
|
+ IFNULL(SUM(buy_old_user_num), 0) old_user_num,
|
|
|
+ IFNULL(SUM(buy_old_user_amount), 0) old_user_amount,
|
|
|
+ IFNULL(SUM(buy_amount_count), 0) amount_count,
|
|
|
+ IFNULL(SUM(buy_amount_num), 0) amount_num,
|
|
|
+ IFNULL(SUM(buy_amount), 0) amount,
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount), 0) new_user_total_amount,
|
|
|
+ round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
+ round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) first_amount_rate,
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) today_amount_rate,
|
|
|
+ round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) new_user_rate,
|
|
|
+ round(if(SUM(buy_first_new_user_amount_count) > 0, SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_count) > 0, SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
+ round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) avg_amount,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(buy_reg_order_user_again) / SUM(buy_new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) reg_user_arpu,
|
|
|
+ round(if(SUM(buy_first_new_user_amount_num) > 0 , SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0 , SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
+ round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) amount_arpu,
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) reg_cost,
|
|
|
+ round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
+ round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
+ IFNULL(SUM(buy_hundred_user_num), 0) hundred_user_num,
|
|
|
+ round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
+ IFNULL(SUM(buy_first_role_num), 0) first_role_num,
|
|
|
+ IFNULL(SUM(buy_role_num), 0) role_num,
|
|
|
+ IFNULL(SUM(buy_new_user_total_role_num), 0) new_user_total_role_num,
|
|
|
+ round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) first_role_num_cost,
|
|
|
+ round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) role_num_cost,
|
|
|
+ round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) first_role_num_rate,
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) role_num_rate,
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
+ FROM
|
|
|
+ ads_game_day
|
|
|
+ """;
|
|
|
+ } else if ("nature".equals(type)) {
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
+ IFNULL(SUM(nature_reg_num), 0) reg_num,
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount), 0) first_new_user_amount,
|
|
|
+ IFNULL(SUM(nature_old_user_count), 0) old_user_count,
|
|
|
+ IFNULL(SUM(nature_old_user_num), 0) old_user_num,
|
|
|
+ IFNULL(SUM(nature_old_user_amount), 0) old_user_amount,
|
|
|
+ IFNULL(SUM(nature_amount_count), 0) amount_count,
|
|
|
+ IFNULL(SUM(nature_amount_num), 0) amount_num,
|
|
|
+ IFNULL(SUM(nature_amount), 0) amount,
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount), 0) new_user_total_amount,
|
|
|
+ round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
+ round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) first_amount_rate,
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) today_amount_rate,
|
|
|
+ round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) new_user_rate,
|
|
|
+ round(if(SUM(nature_first_new_user_amount_count) > 0, SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_count) > 0, SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
+ round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) avg_amount,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(nature_reg_order_user_again) / SUM(nature_new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) reg_user_arpu,
|
|
|
+ round(if(SUM(nature_first_new_user_amount_num) > 0 , SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0 , SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
+ round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) amount_arpu,
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) reg_cost,
|
|
|
+ round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
+ round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
+ IFNULL(SUM(nature_hundred_user_num), 0) hundred_user_num,
|
|
|
+ round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
+ IFNULL(SUM(nature_first_role_num), 0) first_role_num,
|
|
|
+ IFNULL(SUM(nature_role_num), 0) role_num,
|
|
|
+ IFNULL(SUM(nature_new_user_total_role_num), 0) new_user_total_role_num,
|
|
|
+ round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) first_role_num_cost,
|
|
|
+ round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) role_num_cost,
|
|
|
+ round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) first_role_num_rate,
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) role_num_rate,
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
+ FROM
|
|
|
+ ads_game_day
|
|
|
+ """;
|
|
|
+ }
|
|
|
+ //total总量数据
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
+ IFNULL(SUM(reg_num), 0) reg_num,
|
|
|
+ IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
+ IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
+ IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
|
|
|
+ IFNULL(SUM(old_user_count), 0) old_user_count,
|
|
|
+ IFNULL(SUM(old_user_num), 0) old_user_num,
|
|
|
+ IFNULL(SUM(old_user_amount), 0) old_user_amount,
|
|
|
+ IFNULL(SUM(amount_count), 0) amount_count,
|
|
|
+ IFNULL(SUM(amount_num), 0) amount_num,
|
|
|
+ IFNULL(SUM(amount), 0) amount,
|
|
|
+ IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
+ IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
+ IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
|
|
|
+ round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
+ round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,
|
|
|
+ round(if(SUM(amount_num) > 0 , SUM(first_new_user_amount_num) / SUM(amount_num) ,0), 4) new_user_rate,
|
|
|
+ round(if(SUM(first_new_user_amount_count) > 0, SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
+ round(if(SUM(new_user_total_amount_count) > 0, SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
+ round(if(SUM(amount_count) > 0, SUM(amount) / SUM(amount_count), 0), 2) avg_amount,
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0, SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(new_user_total_amount) / SUM(reg_num), 0), 2) reg_user_arpu,
|
|
|
+ round(if(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
+ round(if(SUM(amount_num) > 0, SUM(amount) / SUM(amount_num), 0), 2) amount_arpu,
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
|
|
|
+ round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
+ round(if(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
+ IFNULL(SUM(hundred_user_num), 0) hundred_user_num,
|
|
|
+ round(IF(SUM(hundred_user_num) > 0, SUM(cost) / SUM(hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
+ IFNULL(SUM(first_role_num), 0) first_role_num,
|
|
|
+ IFNULL(SUM(role_num), 0) role_num,
|
|
|
+ IFNULL(SUM(new_user_total_role_num), 0) new_user_total_role_num,
|
|
|
+ round(IF(SUM(first_role_num) > 0, SUM(cost) / SUM(first_role_num), 0), 2) first_role_num_cost,
|
|
|
+ round(IF(SUM(role_num) > 0, SUM(cost) / SUM(role_num), 0), 2) role_num_cost,
|
|
|
+ round(IF(SUM(new_user_total_role_num) >0, SUM(cost) / SUM(new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(first_role_num) / SUM(reg_num), 0), 4) first_role_num_rate,
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(role_num) / SUM(reg_num), 0), 4) role_num_rate,
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(new_user_total_role_num) / SUM(reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
+ FROM
|
|
|
+ ads_game_day
|
|
|
+ """;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ltv总计一栏sql,(ltv部分)
|
|
|
+ * @param type 查询的类型 buy、nature、total
|
|
|
+ * @return String
|
|
|
+ */
|
|
|
+ private String getLtvDataTotalLtvData(String type) {
|
|
|
+ if ("buy".equals(type)) {
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da1) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv1,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da2) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv2,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da3) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv3,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da4) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv4,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da5) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv5,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da6) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv6,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da7) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv7,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da8) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv8,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da9) / SUM(buy_reg_user_cnt) , 0), 2) as user_ltv9,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da10) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv10,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da11) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv11,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da12) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv12,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da13) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv13,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da14) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv14,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da15) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv15,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da16) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv16,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da17) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv17,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da18) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv18,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da19) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv19,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da20) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv20,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da21) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv21,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da22) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv22,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da23) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv23,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da24) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv24,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da25) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv25,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da26) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv26,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da27) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv27,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da28) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv28,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da29) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv29,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da30) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv30,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da31) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv31,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da32) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv32,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da33) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv33,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da34) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv34,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da35) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv35,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da36) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv36,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da37) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv37,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da38) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv38,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da39) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv39,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da40) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv40,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da41) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv41,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da42) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv42,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da43) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv43,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da44) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv44,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da45) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv45,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da46) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv46,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da47) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv47,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da48) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv48,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da49) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv49,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da50) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv50,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da51) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv51,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da52) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv52,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da53) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv53,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da54) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv54,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da55) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv55,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da56) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv56,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da57) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv57,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da58) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv58,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da59) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv59,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da60) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv60,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da61) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv61,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da62) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv62,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da63) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv63,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da64) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv64,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da65) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv65,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da66) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv66,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da67) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv67,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da68) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv68,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da69) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv69,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da70) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv70,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da71) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv71,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da72) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv72,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da73) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv73,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da74) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv74,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da75) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv75,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da76) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv76,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da77) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv77,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da78) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv78,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da79) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv79,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da80) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv80,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da81) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv81,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da82) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv82,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da83) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv83,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da84) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv84,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da85) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv85,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da86) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv86,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da87) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv87,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da88) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv88,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da89) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv89,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_da90) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv90,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m4) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m4,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m5) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m5,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m6) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m6,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m7) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m7,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m8) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m8,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m9) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m9,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m10) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m10,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_m11) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_m11,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_y1) / SUM(buy_reg_user_cnt), 0), 2) as user_ltv_y1,
|
|
|
+ ROUND(IF(SUM(buy_reg_user_cnt) > 0, SUM(buy_total) / SUM(buy_first_role_num), 0), 2) as user_ltv_total,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da1) / SUM(buy_first_role_num) , 0), 2) as role_ltv1,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da2) / SUM(buy_first_role_num) , 0), 2) as role_ltv2,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da3) / SUM(buy_first_role_num) , 0), 2) as role_ltv3,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da4) / SUM(buy_first_role_num) , 0), 2) as role_ltv4,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da5) / SUM(buy_first_role_num) , 0), 2) as role_ltv5,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da6) / SUM(buy_first_role_num) , 0), 2) as role_ltv6,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da7) / SUM(buy_first_role_num) , 0), 2) as role_ltv7,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da8) / SUM(buy_first_role_num) , 0), 2) as role_ltv8,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da9) / SUM(buy_first_role_num) , 0), 2) as role_ltv9,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da10) / SUM(buy_first_role_num), 0), 2) as role_ltv10,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da11) / SUM(buy_first_role_num), 0), 2) as role_ltv11,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da12) / SUM(buy_first_role_num), 0), 2) as role_ltv12,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da13) / SUM(buy_first_role_num), 0), 2) as role_ltv13,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da14) / SUM(buy_first_role_num), 0), 2) as role_ltv14,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da15) / SUM(buy_first_role_num), 0), 2) as role_ltv15,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da16) / SUM(buy_first_role_num), 0), 2) as role_ltv16,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da17) / SUM(buy_first_role_num), 0), 2) as role_ltv17,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da18) / SUM(buy_first_role_num), 0), 2) as role_ltv18,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da19) / SUM(buy_first_role_num), 0), 2) as role_ltv19,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da20) / SUM(buy_first_role_num), 0), 2) as role_ltv20,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da21) / SUM(buy_first_role_num), 0), 2) as role_ltv21,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da22) / SUM(buy_first_role_num), 0), 2) as role_ltv22,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da23) / SUM(buy_first_role_num), 0), 2) as role_ltv23,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da24) / SUM(buy_first_role_num), 0), 2) as role_ltv24,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da25) / SUM(buy_first_role_num), 0), 2) as role_ltv25,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da26) / SUM(buy_first_role_num), 0), 2) as role_ltv26,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da27) / SUM(buy_first_role_num), 0), 2) as role_ltv27,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da28) / SUM(buy_first_role_num), 0), 2) as role_ltv28,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da29) / SUM(buy_first_role_num), 0), 2) as role_ltv29,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da30) / SUM(buy_first_role_num), 0), 2) as role_ltv30,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da31) / SUM(buy_first_role_num), 0), 2) as role_ltv31,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da32) / SUM(buy_first_role_num), 0), 2) as role_ltv32,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da33) / SUM(buy_first_role_num), 0), 2) as role_ltv33,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da34) / SUM(buy_first_role_num), 0), 2) as role_ltv34,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da35) / SUM(buy_first_role_num), 0), 2) as role_ltv35,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da36) / SUM(buy_first_role_num), 0), 2) as role_ltv36,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da37) / SUM(buy_first_role_num), 0), 2) as role_ltv37,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da38) / SUM(buy_first_role_num), 0), 2) as role_ltv38,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da39) / SUM(buy_first_role_num), 0), 2) as role_ltv39,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da40) / SUM(buy_first_role_num), 0), 2) as role_ltv40,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da41) / SUM(buy_first_role_num), 0), 2) as role_ltv41,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da42) / SUM(buy_first_role_num), 0), 2) as role_ltv42,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da43) / SUM(buy_first_role_num), 0), 2) as role_ltv43,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da44) / SUM(buy_first_role_num), 0), 2) as role_ltv44,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da45) / SUM(buy_first_role_num), 0), 2) as role_ltv45,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da46) / SUM(buy_first_role_num), 0), 2) as role_ltv46,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da47) / SUM(buy_first_role_num), 0), 2) as role_ltv47,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da48) / SUM(buy_first_role_num), 0), 2) as role_ltv48,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da49) / SUM(buy_first_role_num), 0), 2) as role_ltv49,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da50) / SUM(buy_first_role_num), 0), 2) as role_ltv50,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da51) / SUM(buy_first_role_num), 0), 2) as role_ltv51,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da52) / SUM(buy_first_role_num), 0), 2) as role_ltv52,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da53) / SUM(buy_first_role_num), 0), 2) as role_ltv53,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da54) / SUM(buy_first_role_num), 0), 2) as role_ltv54,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da55) / SUM(buy_first_role_num), 0), 2) as role_ltv55,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da56) / SUM(buy_first_role_num), 0), 2) as role_ltv56,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da57) / SUM(buy_first_role_num), 0), 2) as role_ltv57,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da58) / SUM(buy_first_role_num), 0), 2) as role_ltv58,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da59) / SUM(buy_first_role_num), 0), 2) as role_ltv59,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da60) / SUM(buy_first_role_num), 0), 2) as role_ltv60,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da61) / SUM(buy_first_role_num), 0), 2) as role_ltv61,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da62) / SUM(buy_first_role_num), 0), 2) as role_ltv62,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da63) / SUM(buy_first_role_num), 0), 2) as role_ltv63,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da64) / SUM(buy_first_role_num), 0), 2) as role_ltv64,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da65) / SUM(buy_first_role_num), 0), 2) as role_ltv65,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da66) / SUM(buy_first_role_num), 0), 2) as role_ltv66,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da67) / SUM(buy_first_role_num), 0), 2) as role_ltv67,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da68) / SUM(buy_first_role_num), 0), 2) as role_ltv68,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da69) / SUM(buy_first_role_num), 0), 2) as role_ltv69,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da70) / SUM(buy_first_role_num), 0), 2) as role_ltv70,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da71) / SUM(buy_first_role_num), 0), 2) as role_ltv71,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da72) / SUM(buy_first_role_num), 0), 2) as role_ltv72,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da73) / SUM(buy_first_role_num), 0), 2) as role_ltv73,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da74) / SUM(buy_first_role_num), 0), 2) as role_ltv74,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da75) / SUM(buy_first_role_num), 0), 2) as role_ltv75,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da76) / SUM(buy_first_role_num), 0), 2) as role_ltv76,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da77) / SUM(buy_first_role_num), 0), 2) as role_ltv77,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da78) / SUM(buy_first_role_num), 0), 2) as role_ltv78,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da79) / SUM(buy_first_role_num), 0), 2) as role_ltv79,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da80) / SUM(buy_first_role_num), 0), 2) as role_ltv80,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da81) / SUM(buy_first_role_num), 0), 2) as role_ltv81,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da82) / SUM(buy_first_role_num), 0), 2) as role_ltv82,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da83) / SUM(buy_first_role_num), 0), 2) as role_ltv83,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da84) / SUM(buy_first_role_num), 0), 2) as role_ltv84,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da85) / SUM(buy_first_role_num), 0), 2) as role_ltv85,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da86) / SUM(buy_first_role_num), 0), 2) as role_ltv86,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da87) / SUM(buy_first_role_num), 0), 2) as role_ltv87,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da88) / SUM(buy_first_role_num), 0), 2) as role_ltv88,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da89) / SUM(buy_first_role_num), 0), 2) as role_ltv89,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_da90) / SUM(buy_first_role_num), 0), 2) as role_ltv90,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m4) / SUM(buy_first_role_num), 0), 2) as role_ltv_m4,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m5) / SUM(buy_first_role_num), 0), 2) as role_ltv_m5,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m6) / SUM(buy_first_role_num), 0), 2) as role_ltv_m6,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m7) / SUM(buy_first_role_num), 0), 2) as role_ltv_m7,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m8) / SUM(buy_first_role_num), 0), 2) as role_ltv_m8,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m9) / SUM(buy_first_role_num), 0), 2) as role_ltv_m9,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m10) / SUM(buy_first_role_num), 0), 2) as role_ltv_m10,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_m11) / SUM(buy_first_role_num), 0), 2) as role_ltv_m11,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_y1) / SUM(buy_first_role_num), 0), 2) as role_ltv_y1,
|
|
|
+ ROUND(IF(SUM(buy_first_role_num) > 0, SUM(buy_total) / SUM(buy_first_role_num), 0), 2) as role_ltv_total,
|
|
|
+ IFNULL(SUM(buy_da1), 0) as da1,
|
|
|
+ IFNULL(SUM(buy_da2), 0) as da2,
|
|
|
+ IFNULL(SUM(buy_da3), 0) as da3,
|
|
|
+ IFNULL(SUM(buy_da4), 0) as da4,
|
|
|
+ IFNULL(SUM(buy_da5), 0) as da5,
|
|
|
+ IFNULL(SUM(buy_da6), 0) as da6,
|
|
|
+ IFNULL(SUM(buy_da7), 0) as da7,
|
|
|
+ IFNULL(SUM(buy_da8), 0) as da8,
|
|
|
+ IFNULL(SUM(buy_da9), 0) as da9,
|
|
|
+ IFNULL(SUM(buy_da10), 0) as da10,
|
|
|
+ IFNULL(SUM(buy_da11), 0) as da11,
|
|
|
+ IFNULL(SUM(buy_da12), 0) as da12,
|
|
|
+ IFNULL(SUM(buy_da13), 0) as da13,
|
|
|
+ IFNULL(SUM(buy_da14), 0) as da14,
|
|
|
+ IFNULL(SUM(buy_da15), 0) as da15,
|
|
|
+ IFNULL(SUM(buy_da16), 0) as da16,
|
|
|
+ IFNULL(SUM(buy_da17), 0) as da17,
|
|
|
+ IFNULL(SUM(buy_da18), 0) as da18,
|
|
|
+ IFNULL(SUM(buy_da19), 0) as da19,
|
|
|
+ IFNULL(SUM(buy_da20), 0) as da20,
|
|
|
+ IFNULL(SUM(buy_da21), 0) as da21,
|
|
|
+ IFNULL(SUM(buy_da22), 0) as da22,
|
|
|
+ IFNULL(SUM(buy_da23), 0) as da23,
|
|
|
+ IFNULL(SUM(buy_da24), 0) as da24,
|
|
|
+ IFNULL(SUM(buy_da25), 0) as da25,
|
|
|
+ IFNULL(SUM(buy_da26), 0) as da26,
|
|
|
+ IFNULL(SUM(buy_da27), 0) as da27,
|
|
|
+ IFNULL(SUM(buy_da28), 0) as da28,
|
|
|
+ IFNULL(SUM(buy_da29), 0) as da29,
|
|
|
+ IFNULL(SUM(buy_da30), 0) as da30,
|
|
|
+ IFNULL(SUM(buy_da31), 0) as da31,
|
|
|
+ IFNULL(SUM(buy_da32), 0) as da32,
|
|
|
+ IFNULL(SUM(buy_da33), 0) as da33,
|
|
|
+ IFNULL(SUM(buy_da34), 0) as da34,
|
|
|
+ IFNULL(SUM(buy_da35), 0) as da35,
|
|
|
+ IFNULL(SUM(buy_da36), 0) as da36,
|
|
|
+ IFNULL(SUM(buy_da37), 0) as da37,
|
|
|
+ IFNULL(SUM(buy_da38), 0) as da38,
|
|
|
+ IFNULL(SUM(buy_da39), 0) as da39,
|
|
|
+ IFNULL(SUM(buy_da40), 0) as da40,
|
|
|
+ IFNULL(SUM(buy_da41), 0) as da41,
|
|
|
+ IFNULL(SUM(buy_da42), 0) as da42,
|
|
|
+ IFNULL(SUM(buy_da43), 0) as da43,
|
|
|
+ IFNULL(SUM(buy_da44), 0) as da44,
|
|
|
+ IFNULL(SUM(buy_da45), 0) as da45,
|
|
|
+ IFNULL(SUM(buy_da46), 0) as da46,
|
|
|
+ IFNULL(SUM(buy_da47), 0) as da47,
|
|
|
+ IFNULL(SUM(buy_da48), 0) as da48,
|
|
|
+ IFNULL(SUM(buy_da49), 0) as da49,
|
|
|
+ IFNULL(SUM(buy_da50), 0) as da50,
|
|
|
+ IFNULL(SUM(buy_da51), 0) as da51,
|
|
|
+ IFNULL(SUM(buy_da52), 0) as da52,
|
|
|
+ IFNULL(SUM(buy_da53), 0) as da53,
|
|
|
+ IFNULL(SUM(buy_da54), 0) as da54,
|
|
|
+ IFNULL(SUM(buy_da55), 0) as da55,
|
|
|
+ IFNULL(SUM(buy_da56), 0) as da56,
|
|
|
+ IFNULL(SUM(buy_da57), 0) as da57,
|
|
|
+ IFNULL(SUM(buy_da58), 0) as da58,
|
|
|
+ IFNULL(SUM(buy_da59), 0) as da59,
|
|
|
+ IFNULL(SUM(buy_da60), 0) as da60,
|
|
|
+ IFNULL(SUM(buy_da61), 0) as da61,
|
|
|
+ IFNULL(SUM(buy_da62), 0) as da62,
|
|
|
+ IFNULL(SUM(buy_da63), 0) as da63,
|
|
|
+ IFNULL(SUM(buy_da64), 0) as da64,
|
|
|
+ IFNULL(SUM(buy_da65), 0) as da65,
|
|
|
+ IFNULL(SUM(buy_da66), 0) as da66,
|
|
|
+ IFNULL(SUM(buy_da67), 0) as da67,
|
|
|
+ IFNULL(SUM(buy_da68), 0) as da68,
|
|
|
+ IFNULL(SUM(buy_da69), 0) as da69,
|
|
|
+ IFNULL(SUM(buy_da70), 0) as da70,
|
|
|
+ IFNULL(SUM(buy_da71), 0) as da71,
|
|
|
+ IFNULL(SUM(buy_da72), 0) as da72,
|
|
|
+ IFNULL(SUM(buy_da73), 0) as da73,
|
|
|
+ IFNULL(SUM(buy_da74), 0) as da74,
|
|
|
+ IFNULL(SUM(buy_da75), 0) as da75,
|
|
|
+ IFNULL(SUM(buy_da76), 0) as da76,
|
|
|
+ IFNULL(SUM(buy_da77), 0) as da77,
|
|
|
+ IFNULL(SUM(buy_da78), 0) as da78,
|
|
|
+ IFNULL(SUM(buy_da79), 0) as da79,
|
|
|
+ IFNULL(SUM(buy_da80), 0) as da80,
|
|
|
+ IFNULL(SUM(buy_da81), 0) as da81,
|
|
|
+ IFNULL(SUM(buy_da82), 0) as da82,
|
|
|
+ IFNULL(SUM(buy_da83), 0) as da83,
|
|
|
+ IFNULL(SUM(buy_da84), 0) as da84,
|
|
|
+ IFNULL(SUM(buy_da85), 0) as da85,
|
|
|
+ IFNULL(SUM(buy_da86), 0) as da86,
|
|
|
+ IFNULL(SUM(buy_da87), 0) as da87,
|
|
|
+ IFNULL(SUM(buy_da88), 0) as da88,
|
|
|
+ IFNULL(SUM(buy_da89), 0) as da89,
|
|
|
+ IFNULL(SUM(buy_da90), 0) as da90,
|
|
|
+ IFNULL(SUM(buy_m4), 0) as m4,
|
|
|
+ IFNULL(SUM(buy_m5), 0) as m5,
|
|
|
+ IFNULL(SUM(buy_m6), 0) as m6,
|
|
|
+ IFNULL(SUM(buy_m7), 0) as m7,
|
|
|
+ IFNULL(SUM(buy_m8), 0) as m8,
|
|
|
+ IFNULL(SUM(buy_m9), 0) as m9,
|
|
|
+ IFNULL(SUM(buy_m10), 0) as m10,
|
|
|
+ IFNULL(SUM(buy_m11), 0) as m11,
|
|
|
+ IFNULL(SUM(buy_y1), 0) as y1,
|
|
|
+ IFNULL(SUM(buy_total), 0) as total,
|
|
|
+ IFNULL(SUM(buy_first_role_num), 0) as first_role_num_ltv,
|
|
|
+ IFNULL(SUM(buy_reg_user_cnt), 0) as reg_user_cnt
|
|
|
+ FROM
|
|
|
+ ads_user_role_ltv_trend
|
|
|
+ """;
|
|
|
+ } else if ("nature".equals(type)) {
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da1) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv1,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da2) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv2,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da3) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv3,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da4) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv4,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da5) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv5,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da6) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv6,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da7) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv7,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da8) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv8,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da9) / SUM(nature_reg_user_cnt) , 0), 2) as user_ltv9,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da10) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv10,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da11) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv11,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da12) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv12,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da13) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv13,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da14) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv14,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da15) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv15,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da16) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv16,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da17) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv17,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da18) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv18,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da19) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv19,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da20) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv20,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da21) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv21,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da22) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv22,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da23) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv23,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da24) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv24,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da25) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv25,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da26) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv26,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da27) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv27,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da28) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv28,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da29) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv29,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da30) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv30,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da31) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv31,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da32) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv32,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da33) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv33,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da34) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv34,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da35) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv35,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da36) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv36,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da37) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv37,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da38) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv38,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da39) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv39,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da40) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv40,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da41) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv41,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da42) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv42,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da43) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv43,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da44) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv44,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da45) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv45,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da46) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv46,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da47) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv47,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da48) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv48,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da49) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv49,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da50) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv50,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da51) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv51,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da52) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv52,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da53) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv53,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da54) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv54,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da55) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv55,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da56) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv56,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da57) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv57,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da58) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv58,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da59) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv59,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da60) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv60,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da61) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv61,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da62) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv62,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da63) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv63,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da64) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv64,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da65) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv65,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da66) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv66,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da67) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv67,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da68) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv68,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da69) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv69,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da70) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv70,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da71) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv71,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da72) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv72,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da73) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv73,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da74) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv74,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da75) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv75,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da76) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv76,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da77) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv77,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da78) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv78,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da79) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv79,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da80) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv80,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da81) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv81,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da82) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv82,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da83) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv83,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da84) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv84,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da85) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv85,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da86) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv86,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da87) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv87,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da88) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv88,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da89) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv89,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_da90) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv90,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m4) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m4,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m5) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m5,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m6) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m6,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m7) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m7,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m8) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m8,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m9) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m9,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m10) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m10,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_m11) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_m11,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_y1) / SUM(nature_reg_user_cnt), 0), 2) as user_ltv_y1,
|
|
|
+ ROUND(IF(SUM(nature_reg_user_cnt) > 0, SUM(nature_total) / SUM(nature_first_role_num), 0), 2) as user_ltv_total,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da1) / SUM(nature_first_role_num) , 0), 2) as role_ltv1,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da2) / SUM(nature_first_role_num) , 0), 2) as role_ltv2,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da3) / SUM(nature_first_role_num) , 0), 2) as role_ltv3,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da4) / SUM(nature_first_role_num) , 0), 2) as role_ltv4,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da5) / SUM(nature_first_role_num) , 0), 2) as role_ltv5,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da6) / SUM(nature_first_role_num) , 0), 2) as role_ltv6,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da7) / SUM(nature_first_role_num) , 0), 2) as role_ltv7,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da8) / SUM(nature_first_role_num) , 0), 2) as role_ltv8,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da9) / SUM(nature_first_role_num) , 0), 2) as role_ltv9,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da10) / SUM(nature_first_role_num), 0), 2) as role_ltv10,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da11) / SUM(nature_first_role_num), 0), 2) as role_ltv11,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da12) / SUM(nature_first_role_num), 0), 2) as role_ltv12,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da13) / SUM(nature_first_role_num), 0), 2) as role_ltv13,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da14) / SUM(nature_first_role_num), 0), 2) as role_ltv14,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da15) / SUM(nature_first_role_num), 0), 2) as role_ltv15,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da16) / SUM(nature_first_role_num), 0), 2) as role_ltv16,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da17) / SUM(nature_first_role_num), 0), 2) as role_ltv17,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da18) / SUM(nature_first_role_num), 0), 2) as role_ltv18,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da19) / SUM(nature_first_role_num), 0), 2) as role_ltv19,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da20) / SUM(nature_first_role_num), 0), 2) as role_ltv20,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da21) / SUM(nature_first_role_num), 0), 2) as role_ltv21,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da22) / SUM(nature_first_role_num), 0), 2) as role_ltv22,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da23) / SUM(nature_first_role_num), 0), 2) as role_ltv23,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da24) / SUM(nature_first_role_num), 0), 2) as role_ltv24,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da25) / SUM(nature_first_role_num), 0), 2) as role_ltv25,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da26) / SUM(nature_first_role_num), 0), 2) as role_ltv26,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da27) / SUM(nature_first_role_num), 0), 2) as role_ltv27,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da28) / SUM(nature_first_role_num), 0), 2) as role_ltv28,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da29) / SUM(nature_first_role_num), 0), 2) as role_ltv29,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da30) / SUM(nature_first_role_num), 0), 2) as role_ltv30,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da31) / SUM(nature_first_role_num), 0), 2) as role_ltv31,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da32) / SUM(nature_first_role_num), 0), 2) as role_ltv32,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da33) / SUM(nature_first_role_num), 0), 2) as role_ltv33,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da34) / SUM(nature_first_role_num), 0), 2) as role_ltv34,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da35) / SUM(nature_first_role_num), 0), 2) as role_ltv35,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da36) / SUM(nature_first_role_num), 0), 2) as role_ltv36,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da37) / SUM(nature_first_role_num), 0), 2) as role_ltv37,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da38) / SUM(nature_first_role_num), 0), 2) as role_ltv38,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da39) / SUM(nature_first_role_num), 0), 2) as role_ltv39,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da40) / SUM(nature_first_role_num), 0), 2) as role_ltv40,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da41) / SUM(nature_first_role_num), 0), 2) as role_ltv41,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da42) / SUM(nature_first_role_num), 0), 2) as role_ltv42,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da43) / SUM(nature_first_role_num), 0), 2) as role_ltv43,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da44) / SUM(nature_first_role_num), 0), 2) as role_ltv44,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da45) / SUM(nature_first_role_num), 0), 2) as role_ltv45,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da46) / SUM(nature_first_role_num), 0), 2) as role_ltv46,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da47) / SUM(nature_first_role_num), 0), 2) as role_ltv47,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da48) / SUM(nature_first_role_num), 0), 2) as role_ltv48,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da49) / SUM(nature_first_role_num), 0), 2) as role_ltv49,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da50) / SUM(nature_first_role_num), 0), 2) as role_ltv50,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da51) / SUM(nature_first_role_num), 0), 2) as role_ltv51,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da52) / SUM(nature_first_role_num), 0), 2) as role_ltv52,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da53) / SUM(nature_first_role_num), 0), 2) as role_ltv53,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da54) / SUM(nature_first_role_num), 0), 2) as role_ltv54,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da55) / SUM(nature_first_role_num), 0), 2) as role_ltv55,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da56) / SUM(nature_first_role_num), 0), 2) as role_ltv56,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da57) / SUM(nature_first_role_num), 0), 2) as role_ltv57,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da58) / SUM(nature_first_role_num), 0), 2) as role_ltv58,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da59) / SUM(nature_first_role_num), 0), 2) as role_ltv59,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da60) / SUM(nature_first_role_num), 0), 2) as role_ltv60,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da61) / SUM(nature_first_role_num), 0), 2) as role_ltv61,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da62) / SUM(nature_first_role_num), 0), 2) as role_ltv62,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da63) / SUM(nature_first_role_num), 0), 2) as role_ltv63,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da64) / SUM(nature_first_role_num), 0), 2) as role_ltv64,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da65) / SUM(nature_first_role_num), 0), 2) as role_ltv65,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da66) / SUM(nature_first_role_num), 0), 2) as role_ltv66,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da67) / SUM(nature_first_role_num), 0), 2) as role_ltv67,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da68) / SUM(nature_first_role_num), 0), 2) as role_ltv68,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da69) / SUM(nature_first_role_num), 0), 2) as role_ltv69,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da70) / SUM(nature_first_role_num), 0), 2) as role_ltv70,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da71) / SUM(nature_first_role_num), 0), 2) as role_ltv71,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da72) / SUM(nature_first_role_num), 0), 2) as role_ltv72,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da73) / SUM(nature_first_role_num), 0), 2) as role_ltv73,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da74) / SUM(nature_first_role_num), 0), 2) as role_ltv74,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da75) / SUM(nature_first_role_num), 0), 2) as role_ltv75,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da76) / SUM(nature_first_role_num), 0), 2) as role_ltv76,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da77) / SUM(nature_first_role_num), 0), 2) as role_ltv77,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da78) / SUM(nature_first_role_num), 0), 2) as role_ltv78,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da79) / SUM(nature_first_role_num), 0), 2) as role_ltv79,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da80) / SUM(nature_first_role_num), 0), 2) as role_ltv80,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da81) / SUM(nature_first_role_num), 0), 2) as role_ltv81,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da82) / SUM(nature_first_role_num), 0), 2) as role_ltv82,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da83) / SUM(nature_first_role_num), 0), 2) as role_ltv83,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da84) / SUM(nature_first_role_num), 0), 2) as role_ltv84,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da85) / SUM(nature_first_role_num), 0), 2) as role_ltv85,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da86) / SUM(nature_first_role_num), 0), 2) as role_ltv86,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da87) / SUM(nature_first_role_num), 0), 2) as role_ltv87,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da88) / SUM(nature_first_role_num), 0), 2) as role_ltv88,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da89) / SUM(nature_first_role_num), 0), 2) as role_ltv89,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_da90) / SUM(nature_first_role_num), 0), 2) as role_ltv90,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m4) / SUM(nature_first_role_num), 0), 2) as role_ltv_m4,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m5) / SUM(nature_first_role_num), 0), 2) as role_ltv_m5,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m6) / SUM(nature_first_role_num), 0), 2) as role_ltv_m6,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m7) / SUM(nature_first_role_num), 0), 2) as role_ltv_m7,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m8) / SUM(nature_first_role_num), 0), 2) as role_ltv_m8,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m9) / SUM(nature_first_role_num), 0), 2) as role_ltv_m9,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m10) / SUM(nature_first_role_num), 0), 2) as role_ltv_m10,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_m11) / SUM(nature_first_role_num), 0), 2) as role_ltv_m11,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_y1) / SUM(nature_first_role_num), 0), 2) as role_ltv_y1,
|
|
|
+ ROUND(IF(SUM(nature_first_role_num) > 0, SUM(nature_total) / SUM(nature_first_role_num), 0), 2) as role_ltv_total,
|
|
|
+ IFNULL(SUM(nature_da1), 0) as da1,
|
|
|
+ IFNULL(SUM(nature_da2), 0) as da2,
|
|
|
+ IFNULL(SUM(nature_da3), 0) as da3,
|
|
|
+ IFNULL(SUM(nature_da4), 0) as da4,
|
|
|
+ IFNULL(SUM(nature_da5), 0) as da5,
|
|
|
+ IFNULL(SUM(nature_da6), 0) as da6,
|
|
|
+ IFNULL(SUM(nature_da7), 0) as da7,
|
|
|
+ IFNULL(SUM(nature_da8), 0) as da8,
|
|
|
+ IFNULL(SUM(nature_da9), 0) as da9,
|
|
|
+ IFNULL(SUM(nature_da10), 0) as da10,
|
|
|
+ IFNULL(SUM(nature_da11), 0) as da11,
|
|
|
+ IFNULL(SUM(nature_da12), 0) as da12,
|
|
|
+ IFNULL(SUM(nature_da13), 0) as da13,
|
|
|
+ IFNULL(SUM(nature_da14), 0) as da14,
|
|
|
+ IFNULL(SUM(nature_da15), 0) as da15,
|
|
|
+ IFNULL(SUM(nature_da16), 0) as da16,
|
|
|
+ IFNULL(SUM(nature_da17), 0) as da17,
|
|
|
+ IFNULL(SUM(nature_da18), 0) as da18,
|
|
|
+ IFNULL(SUM(nature_da19), 0) as da19,
|
|
|
+ IFNULL(SUM(nature_da20), 0) as da20,
|
|
|
+ IFNULL(SUM(nature_da21), 0) as da21,
|
|
|
+ IFNULL(SUM(nature_da22), 0) as da22,
|
|
|
+ IFNULL(SUM(nature_da23), 0) as da23,
|
|
|
+ IFNULL(SUM(nature_da24), 0) as da24,
|
|
|
+ IFNULL(SUM(nature_da25), 0) as da25,
|
|
|
+ IFNULL(SUM(nature_da26), 0) as da26,
|
|
|
+ IFNULL(SUM(nature_da27), 0) as da27,
|
|
|
+ IFNULL(SUM(nature_da28), 0) as da28,
|
|
|
+ IFNULL(SUM(nature_da29), 0) as da29,
|
|
|
+ IFNULL(SUM(nature_da30), 0) as da30,
|
|
|
+ IFNULL(SUM(nature_da31), 0) as da31,
|
|
|
+ IFNULL(SUM(nature_da32), 0) as da32,
|
|
|
+ IFNULL(SUM(nature_da33), 0) as da33,
|
|
|
+ IFNULL(SUM(nature_da34), 0) as da34,
|
|
|
+ IFNULL(SUM(nature_da35), 0) as da35,
|
|
|
+ IFNULL(SUM(nature_da36), 0) as da36,
|
|
|
+ IFNULL(SUM(nature_da37), 0) as da37,
|
|
|
+ IFNULL(SUM(nature_da38), 0) as da38,
|
|
|
+ IFNULL(SUM(nature_da39), 0) as da39,
|
|
|
+ IFNULL(SUM(nature_da40), 0) as da40,
|
|
|
+ IFNULL(SUM(nature_da41), 0) as da41,
|
|
|
+ IFNULL(SUM(nature_da42), 0) as da42,
|
|
|
+ IFNULL(SUM(nature_da43), 0) as da43,
|
|
|
+ IFNULL(SUM(nature_da44), 0) as da44,
|
|
|
+ IFNULL(SUM(nature_da45), 0) as da45,
|
|
|
+ IFNULL(SUM(nature_da46), 0) as da46,
|
|
|
+ IFNULL(SUM(nature_da47), 0) as da47,
|
|
|
+ IFNULL(SUM(nature_da48), 0) as da48,
|
|
|
+ IFNULL(SUM(nature_da49), 0) as da49,
|
|
|
+ IFNULL(SUM(nature_da50), 0) as da50,
|
|
|
+ IFNULL(SUM(nature_da51), 0) as da51,
|
|
|
+ IFNULL(SUM(nature_da52), 0) as da52,
|
|
|
+ IFNULL(SUM(nature_da53), 0) as da53,
|
|
|
+ IFNULL(SUM(nature_da54), 0) as da54,
|
|
|
+ IFNULL(SUM(nature_da55), 0) as da55,
|
|
|
+ IFNULL(SUM(nature_da56), 0) as da56,
|
|
|
+ IFNULL(SUM(nature_da57), 0) as da57,
|
|
|
+ IFNULL(SUM(nature_da58), 0) as da58,
|
|
|
+ IFNULL(SUM(nature_da59), 0) as da59,
|
|
|
+ IFNULL(SUM(nature_da60), 0) as da60,
|
|
|
+ IFNULL(SUM(nature_da61), 0) as da61,
|
|
|
+ IFNULL(SUM(nature_da62), 0) as da62,
|
|
|
+ IFNULL(SUM(nature_da63), 0) as da63,
|
|
|
+ IFNULL(SUM(nature_da64), 0) as da64,
|
|
|
+ IFNULL(SUM(nature_da65), 0) as da65,
|
|
|
+ IFNULL(SUM(nature_da66), 0) as da66,
|
|
|
+ IFNULL(SUM(nature_da67), 0) as da67,
|
|
|
+ IFNULL(SUM(nature_da68), 0) as da68,
|
|
|
+ IFNULL(SUM(nature_da69), 0) as da69,
|
|
|
+ IFNULL(SUM(nature_da70), 0) as da70,
|
|
|
+ IFNULL(SUM(nature_da71), 0) as da71,
|
|
|
+ IFNULL(SUM(nature_da72), 0) as da72,
|
|
|
+ IFNULL(SUM(nature_da73), 0) as da73,
|
|
|
+ IFNULL(SUM(nature_da74), 0) as da74,
|
|
|
+ IFNULL(SUM(nature_da75), 0) as da75,
|
|
|
+ IFNULL(SUM(nature_da76), 0) as da76,
|
|
|
+ IFNULL(SUM(nature_da77), 0) as da77,
|
|
|
+ IFNULL(SUM(nature_da78), 0) as da78,
|
|
|
+ IFNULL(SUM(nature_da79), 0) as da79,
|
|
|
+ IFNULL(SUM(nature_da80), 0) as da80,
|
|
|
+ IFNULL(SUM(nature_da81), 0) as da81,
|
|
|
+ IFNULL(SUM(nature_da82), 0) as da82,
|
|
|
+ IFNULL(SUM(nature_da83), 0) as da83,
|
|
|
+ IFNULL(SUM(nature_da84), 0) as da84,
|
|
|
+ IFNULL(SUM(nature_da85), 0) as da85,
|
|
|
+ IFNULL(SUM(nature_da86), 0) as da86,
|
|
|
+ IFNULL(SUM(nature_da87), 0) as da87,
|
|
|
+ IFNULL(SUM(nature_da88), 0) as da88,
|
|
|
+ IFNULL(SUM(nature_da89), 0) as da89,
|
|
|
+ IFNULL(SUM(nature_da90), 0) as da90,
|
|
|
+ IFNULL(SUM(nature_m4), 0) as m4,
|
|
|
+ IFNULL(SUM(nature_m5), 0) as m5,
|
|
|
+ IFNULL(SUM(nature_m6), 0) as m6,
|
|
|
+ IFNULL(SUM(nature_m7), 0) as m7,
|
|
|
+ IFNULL(SUM(nature_m8), 0) as m8,
|
|
|
+ IFNULL(SUM(nature_m9), 0) as m9,
|
|
|
+ IFNULL(SUM(nature_m10), 0) as m10,
|
|
|
+ IFNULL(SUM(nature_m11), 0) as m11,
|
|
|
+ IFNULL(SUM(nature_y1), 0) as y1,
|
|
|
+ IFNULL(SUM(nature_total), 0) as total,
|
|
|
+ IFNULL(SUM(nature_first_role_num), 0) as first_role_num_ltv,
|
|
|
+ IFNULL(SUM(nature_reg_user_cnt), 0) as reg_user_cnt
|
|
|
+ FROM
|
|
|
+ ads_user_role_ltv_trend
|
|
|
+ """;
|
|
|
+ }
|
|
|
+ //查询total总量数据时
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da1) / SUM(reg_user_cnt) , 0), 2) as user_ltv1,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da2) / SUM(reg_user_cnt) , 0), 2) as user_ltv2,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da3) / SUM(reg_user_cnt) , 0), 2) as user_ltv3,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da4) / SUM(reg_user_cnt) , 0), 2) as user_ltv4,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da5) / SUM(reg_user_cnt) , 0), 2) as user_ltv5,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da6) / SUM(reg_user_cnt) , 0), 2) as user_ltv6,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da7) / SUM(reg_user_cnt) , 0), 2) as user_ltv7,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da8) / SUM(reg_user_cnt) , 0), 2) as user_ltv8,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da9) / SUM(reg_user_cnt) , 0), 2) as user_ltv9,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da10) / SUM(reg_user_cnt), 0), 2) as user_ltv10,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da11) / SUM(reg_user_cnt), 0), 2) as user_ltv11,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da12) / SUM(reg_user_cnt), 0), 2) as user_ltv12,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da13) / SUM(reg_user_cnt), 0), 2) as user_ltv13,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da14) / SUM(reg_user_cnt), 0), 2) as user_ltv14,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da15) / SUM(reg_user_cnt), 0), 2) as user_ltv15,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da16) / SUM(reg_user_cnt), 0), 2) as user_ltv16,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da17) / SUM(reg_user_cnt), 0), 2) as user_ltv17,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da18) / SUM(reg_user_cnt), 0), 2) as user_ltv18,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da19) / SUM(reg_user_cnt), 0), 2) as user_ltv19,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da20) / SUM(reg_user_cnt), 0), 2) as user_ltv20,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da21) / SUM(reg_user_cnt), 0), 2) as user_ltv21,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da22) / SUM(reg_user_cnt), 0), 2) as user_ltv22,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da23) / SUM(reg_user_cnt), 0), 2) as user_ltv23,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da24) / SUM(reg_user_cnt), 0), 2) as user_ltv24,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da25) / SUM(reg_user_cnt), 0), 2) as user_ltv25,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da26) / SUM(reg_user_cnt), 0), 2) as user_ltv26,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da27) / SUM(reg_user_cnt), 0), 2) as user_ltv27,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da28) / SUM(reg_user_cnt), 0), 2) as user_ltv28,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da29) / SUM(reg_user_cnt), 0), 2) as user_ltv29,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da30) / SUM(reg_user_cnt), 0), 2) as user_ltv30,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da31) / SUM(reg_user_cnt), 0), 2) as user_ltv31,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da32) / SUM(reg_user_cnt), 0), 2) as user_ltv32,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da33) / SUM(reg_user_cnt), 0), 2) as user_ltv33,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da34) / SUM(reg_user_cnt), 0), 2) as user_ltv34,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da35) / SUM(reg_user_cnt), 0), 2) as user_ltv35,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da36) / SUM(reg_user_cnt), 0), 2) as user_ltv36,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da37) / SUM(reg_user_cnt), 0), 2) as user_ltv37,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da38) / SUM(reg_user_cnt), 0), 2) as user_ltv38,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da39) / SUM(reg_user_cnt), 0), 2) as user_ltv39,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da40) / SUM(reg_user_cnt), 0), 2) as user_ltv40,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da41) / SUM(reg_user_cnt), 0), 2) as user_ltv41,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da42) / SUM(reg_user_cnt), 0), 2) as user_ltv42,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da43) / SUM(reg_user_cnt), 0), 2) as user_ltv43,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da44) / SUM(reg_user_cnt), 0), 2) as user_ltv44,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da45) / SUM(reg_user_cnt), 0), 2) as user_ltv45,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da46) / SUM(reg_user_cnt), 0), 2) as user_ltv46,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da47) / SUM(reg_user_cnt), 0), 2) as user_ltv47,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da48) / SUM(reg_user_cnt), 0), 2) as user_ltv48,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da49) / SUM(reg_user_cnt), 0), 2) as user_ltv49,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da50) / SUM(reg_user_cnt), 0), 2) as user_ltv50,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da51) / SUM(reg_user_cnt), 0), 2) as user_ltv51,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da52) / SUM(reg_user_cnt), 0), 2) as user_ltv52,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da53) / SUM(reg_user_cnt), 0), 2) as user_ltv53,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da54) / SUM(reg_user_cnt), 0), 2) as user_ltv54,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da55) / SUM(reg_user_cnt), 0), 2) as user_ltv55,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da56) / SUM(reg_user_cnt), 0), 2) as user_ltv56,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da57) / SUM(reg_user_cnt), 0), 2) as user_ltv57,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da58) / SUM(reg_user_cnt), 0), 2) as user_ltv58,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da59) / SUM(reg_user_cnt), 0), 2) as user_ltv59,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da60) / SUM(reg_user_cnt), 0), 2) as user_ltv60,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da61) / SUM(reg_user_cnt), 0), 2) as user_ltv61,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da62) / SUM(reg_user_cnt), 0), 2) as user_ltv62,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da63) / SUM(reg_user_cnt), 0), 2) as user_ltv63,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da64) / SUM(reg_user_cnt), 0), 2) as user_ltv64,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da65) / SUM(reg_user_cnt), 0), 2) as user_ltv65,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da66) / SUM(reg_user_cnt), 0), 2) as user_ltv66,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da67) / SUM(reg_user_cnt), 0), 2) as user_ltv67,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da68) / SUM(reg_user_cnt), 0), 2) as user_ltv68,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da69) / SUM(reg_user_cnt), 0), 2) as user_ltv69,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da70) / SUM(reg_user_cnt), 0), 2) as user_ltv70,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da71) / SUM(reg_user_cnt), 0), 2) as user_ltv71,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da72) / SUM(reg_user_cnt), 0), 2) as user_ltv72,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da73) / SUM(reg_user_cnt), 0), 2) as user_ltv73,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da74) / SUM(reg_user_cnt), 0), 2) as user_ltv74,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da75) / SUM(reg_user_cnt), 0), 2) as user_ltv75,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da76) / SUM(reg_user_cnt), 0), 2) as user_ltv76,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da77) / SUM(reg_user_cnt), 0), 2) as user_ltv77,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da78) / SUM(reg_user_cnt), 0), 2) as user_ltv78,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da79) / SUM(reg_user_cnt), 0), 2) as user_ltv79,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da80) / SUM(reg_user_cnt), 0), 2) as user_ltv80,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da81) / SUM(reg_user_cnt), 0), 2) as user_ltv81,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da82) / SUM(reg_user_cnt), 0), 2) as user_ltv82,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da83) / SUM(reg_user_cnt), 0), 2) as user_ltv83,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da84) / SUM(reg_user_cnt), 0), 2) as user_ltv84,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da85) / SUM(reg_user_cnt), 0), 2) as user_ltv85,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da86) / SUM(reg_user_cnt), 0), 2) as user_ltv86,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da87) / SUM(reg_user_cnt), 0), 2) as user_ltv87,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da88) / SUM(reg_user_cnt), 0), 2) as user_ltv88,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da89) / SUM(reg_user_cnt), 0), 2) as user_ltv89,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(da90) / SUM(reg_user_cnt), 0), 2) as user_ltv90,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m4) / SUM(reg_user_cnt), 0), 2) as user_ltv_m4,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m5) / SUM(reg_user_cnt), 0), 2) as user_ltv_m5,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m6) / SUM(reg_user_cnt), 0), 2) as user_ltv_m6,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m7) / SUM(reg_user_cnt), 0), 2) as user_ltv_m7,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m8) / SUM(reg_user_cnt), 0), 2) as user_ltv_m8,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m9) / SUM(reg_user_cnt), 0), 2) as user_ltv_m9,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m10) / SUM(reg_user_cnt), 0), 2) as user_ltv_m10,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(m11) / SUM(reg_user_cnt), 0), 2) as user_ltv_m11,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(y1) / SUM(reg_user_cnt), 0), 2) as user_ltv_y1,
|
|
|
+ ROUND(IF(SUM(reg_user_cnt) > 0, SUM(total) / SUM(first_role_num), 0), 2) as user_ltv_total,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da1) / SUM(first_role_num) , 0), 2) as role_ltv1,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da2) / SUM(first_role_num) , 0), 2) as role_ltv2,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da3) / SUM(first_role_num) , 0), 2) as role_ltv3,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da4) / SUM(first_role_num) , 0), 2) as role_ltv4,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da5) / SUM(first_role_num) , 0), 2) as role_ltv5,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da6) / SUM(first_role_num) , 0), 2) as role_ltv6,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da7) / SUM(first_role_num) , 0), 2) as role_ltv7,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da8) / SUM(first_role_num) , 0), 2) as role_ltv8,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da9) / SUM(first_role_num) , 0), 2) as role_ltv9,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da10) / SUM(first_role_num), 0), 2) as role_ltv10,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da11) / SUM(first_role_num), 0), 2) as role_ltv11,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da12) / SUM(first_role_num), 0), 2) as role_ltv12,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da13) / SUM(first_role_num), 0), 2) as role_ltv13,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da14) / SUM(first_role_num), 0), 2) as role_ltv14,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da15) / SUM(first_role_num), 0), 2) as role_ltv15,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da16) / SUM(first_role_num), 0), 2) as role_ltv16,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da17) / SUM(first_role_num), 0), 2) as role_ltv17,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da18) / SUM(first_role_num), 0), 2) as role_ltv18,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da19) / SUM(first_role_num), 0), 2) as role_ltv19,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da20) / SUM(first_role_num), 0), 2) as role_ltv20,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da21) / SUM(first_role_num), 0), 2) as role_ltv21,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da22) / SUM(first_role_num), 0), 2) as role_ltv22,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da23) / SUM(first_role_num), 0), 2) as role_ltv23,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da24) / SUM(first_role_num), 0), 2) as role_ltv24,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da25) / SUM(first_role_num), 0), 2) as role_ltv25,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da26) / SUM(first_role_num), 0), 2) as role_ltv26,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da27) / SUM(first_role_num), 0), 2) as role_ltv27,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da28) / SUM(first_role_num), 0), 2) as role_ltv28,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da29) / SUM(first_role_num), 0), 2) as role_ltv29,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da30) / SUM(first_role_num), 0), 2) as role_ltv30,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da31) / SUM(first_role_num), 0), 2) as role_ltv31,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da32) / SUM(first_role_num), 0), 2) as role_ltv32,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da33) / SUM(first_role_num), 0), 2) as role_ltv33,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da34) / SUM(first_role_num), 0), 2) as role_ltv34,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da35) / SUM(first_role_num), 0), 2) as role_ltv35,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da36) / SUM(first_role_num), 0), 2) as role_ltv36,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da37) / SUM(first_role_num), 0), 2) as role_ltv37,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da38) / SUM(first_role_num), 0), 2) as role_ltv38,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da39) / SUM(first_role_num), 0), 2) as role_ltv39,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da40) / SUM(first_role_num), 0), 2) as role_ltv40,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da41) / SUM(first_role_num), 0), 2) as role_ltv41,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da42) / SUM(first_role_num), 0), 2) as role_ltv42,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da43) / SUM(first_role_num), 0), 2) as role_ltv43,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da44) / SUM(first_role_num), 0), 2) as role_ltv44,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da45) / SUM(first_role_num), 0), 2) as role_ltv45,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da46) / SUM(first_role_num), 0), 2) as role_ltv46,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da47) / SUM(first_role_num), 0), 2) as role_ltv47,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da48) / SUM(first_role_num), 0), 2) as role_ltv48,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da49) / SUM(first_role_num), 0), 2) as role_ltv49,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da50) / SUM(first_role_num), 0), 2) as role_ltv50,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da51) / SUM(first_role_num), 0), 2) as role_ltv51,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da52) / SUM(first_role_num), 0), 2) as role_ltv52,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da53) / SUM(first_role_num), 0), 2) as role_ltv53,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da54) / SUM(first_role_num), 0), 2) as role_ltv54,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da55) / SUM(first_role_num), 0), 2) as role_ltv55,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da56) / SUM(first_role_num), 0), 2) as role_ltv56,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da57) / SUM(first_role_num), 0), 2) as role_ltv57,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da58) / SUM(first_role_num), 0), 2) as role_ltv58,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da59) / SUM(first_role_num), 0), 2) as role_ltv59,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da60) / SUM(first_role_num), 0), 2) as role_ltv60,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da61) / SUM(first_role_num), 0), 2) as role_ltv61,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da62) / SUM(first_role_num), 0), 2) as role_ltv62,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da63) / SUM(first_role_num), 0), 2) as role_ltv63,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da64) / SUM(first_role_num), 0), 2) as role_ltv64,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da65) / SUM(first_role_num), 0), 2) as role_ltv65,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da66) / SUM(first_role_num), 0), 2) as role_ltv66,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da67) / SUM(first_role_num), 0), 2) as role_ltv67,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da68) / SUM(first_role_num), 0), 2) as role_ltv68,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da69) / SUM(first_role_num), 0), 2) as role_ltv69,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da70) / SUM(first_role_num), 0), 2) as role_ltv70,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da71) / SUM(first_role_num), 0), 2) as role_ltv71,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da72) / SUM(first_role_num), 0), 2) as role_ltv72,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da73) / SUM(first_role_num), 0), 2) as role_ltv73,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da74) / SUM(first_role_num), 0), 2) as role_ltv74,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da75) / SUM(first_role_num), 0), 2) as role_ltv75,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da76) / SUM(first_role_num), 0), 2) as role_ltv76,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da77) / SUM(first_role_num), 0), 2) as role_ltv77,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da78) / SUM(first_role_num), 0), 2) as role_ltv78,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da79) / SUM(first_role_num), 0), 2) as role_ltv79,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da80) / SUM(first_role_num), 0), 2) as role_ltv80,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da81) / SUM(first_role_num), 0), 2) as role_ltv81,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da82) / SUM(first_role_num), 0), 2) as role_ltv82,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da83) / SUM(first_role_num), 0), 2) as role_ltv83,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da84) / SUM(first_role_num), 0), 2) as role_ltv84,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da85) / SUM(first_role_num), 0), 2) as role_ltv85,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da86) / SUM(first_role_num), 0), 2) as role_ltv86,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da87) / SUM(first_role_num), 0), 2) as role_ltv87,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da88) / SUM(first_role_num), 0), 2) as role_ltv88,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da89) / SUM(first_role_num), 0), 2) as role_ltv89,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(da90) / SUM(first_role_num), 0), 2) as role_ltv90,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m4) / SUM(first_role_num), 0), 2) as role_ltv_m4,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m5) / SUM(first_role_num), 0), 2) as role_ltv_m5,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m6) / SUM(first_role_num), 0), 2) as role_ltv_m6,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m7) / SUM(first_role_num), 0), 2) as role_ltv_m7,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m8) / SUM(first_role_num), 0), 2) as role_ltv_m8,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m9) / SUM(first_role_num), 0), 2) as role_ltv_m9,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m10) / SUM(first_role_num), 0), 2) as role_ltv_m10,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(m11) / SUM(first_role_num), 0), 2) as role_ltv_m11,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(y1) / SUM(first_role_num), 0), 2) as role_ltv_y1,
|
|
|
+ ROUND(IF(SUM(first_role_num) > 0, SUM(total) / SUM(first_role_num), 0), 2) as role_ltv_total,
|
|
|
+ IFNULL(SUM(da1), 0) as da1,
|
|
|
+ IFNULL(SUM(da2), 0) as da2,
|
|
|
+ IFNULL(SUM(da3), 0) as da3,
|
|
|
+ IFNULL(SUM(da4), 0) as da4,
|
|
|
+ IFNULL(SUM(da5), 0) as da5,
|
|
|
+ IFNULL(SUM(da6), 0) as da6,
|
|
|
+ IFNULL(SUM(da7), 0) as da7,
|
|
|
+ IFNULL(SUM(da8), 0) as da8,
|
|
|
+ IFNULL(SUM(da9), 0) as da9,
|
|
|
+ IFNULL(SUM(da10), 0) as da10,
|
|
|
+ IFNULL(SUM(da11), 0) as da11,
|
|
|
+ IFNULL(SUM(da12), 0) as da12,
|
|
|
+ IFNULL(SUM(da13), 0) as da13,
|
|
|
+ IFNULL(SUM(da14), 0) as da14,
|
|
|
+ IFNULL(SUM(da15), 0) as da15,
|
|
|
+ IFNULL(SUM(da16), 0) as da16,
|
|
|
+ IFNULL(SUM(da17), 0) as da17,
|
|
|
+ IFNULL(SUM(da18), 0) as da18,
|
|
|
+ IFNULL(SUM(da19), 0) as da19,
|
|
|
+ IFNULL(SUM(da20), 0) as da20,
|
|
|
+ IFNULL(SUM(da21), 0) as da21,
|
|
|
+ IFNULL(SUM(da22), 0) as da22,
|
|
|
+ IFNULL(SUM(da23), 0) as da23,
|
|
|
+ IFNULL(SUM(da24), 0) as da24,
|
|
|
+ IFNULL(SUM(da25), 0) as da25,
|
|
|
+ IFNULL(SUM(da26), 0) as da26,
|
|
|
+ IFNULL(SUM(da27), 0) as da27,
|
|
|
+ IFNULL(SUM(da28), 0) as da28,
|
|
|
+ IFNULL(SUM(da29), 0) as da29,
|
|
|
+ IFNULL(SUM(da30), 0) as da30,
|
|
|
+ IFNULL(SUM(da31), 0) as da31,
|
|
|
+ IFNULL(SUM(da32), 0) as da32,
|
|
|
+ IFNULL(SUM(da33), 0) as da33,
|
|
|
+ IFNULL(SUM(da34), 0) as da34,
|
|
|
+ IFNULL(SUM(da35), 0) as da35,
|
|
|
+ IFNULL(SUM(da36), 0) as da36,
|
|
|
+ IFNULL(SUM(da37), 0) as da37,
|
|
|
+ IFNULL(SUM(da38), 0) as da38,
|
|
|
+ IFNULL(SUM(da39), 0) as da39,
|
|
|
+ IFNULL(SUM(da40), 0) as da40,
|
|
|
+ IFNULL(SUM(da41), 0) as da41,
|
|
|
+ IFNULL(SUM(da42), 0) as da42,
|
|
|
+ IFNULL(SUM(da43), 0) as da43,
|
|
|
+ IFNULL(SUM(da44), 0) as da44,
|
|
|
+ IFNULL(SUM(da45), 0) as da45,
|
|
|
+ IFNULL(SUM(da46), 0) as da46,
|
|
|
+ IFNULL(SUM(da47), 0) as da47,
|
|
|
+ IFNULL(SUM(da48), 0) as da48,
|
|
|
+ IFNULL(SUM(da49), 0) as da49,
|
|
|
+ IFNULL(SUM(da50), 0) as da50,
|
|
|
+ IFNULL(SUM(da51), 0) as da51,
|
|
|
+ IFNULL(SUM(da52), 0) as da52,
|
|
|
+ IFNULL(SUM(da53), 0) as da53,
|
|
|
+ IFNULL(SUM(da54), 0) as da54,
|
|
|
+ IFNULL(SUM(da55), 0) as da55,
|
|
|
+ IFNULL(SUM(da56), 0) as da56,
|
|
|
+ IFNULL(SUM(da57), 0) as da57,
|
|
|
+ IFNULL(SUM(da58), 0) as da58,
|
|
|
+ IFNULL(SUM(da59), 0) as da59,
|
|
|
+ IFNULL(SUM(da60), 0) as da60,
|
|
|
+ IFNULL(SUM(da61), 0) as da61,
|
|
|
+ IFNULL(SUM(da62), 0) as da62,
|
|
|
+ IFNULL(SUM(da63), 0) as da63,
|
|
|
+ IFNULL(SUM(da64), 0) as da64,
|
|
|
+ IFNULL(SUM(da65), 0) as da65,
|
|
|
+ IFNULL(SUM(da66), 0) as da66,
|
|
|
+ IFNULL(SUM(da67), 0) as da67,
|
|
|
+ IFNULL(SUM(da68), 0) as da68,
|
|
|
+ IFNULL(SUM(da69), 0) as da69,
|
|
|
+ IFNULL(SUM(da70), 0) as da70,
|
|
|
+ IFNULL(SUM(da71), 0) as da71,
|
|
|
+ IFNULL(SUM(da72), 0) as da72,
|
|
|
+ IFNULL(SUM(da73), 0) as da73,
|
|
|
+ IFNULL(SUM(da74), 0) as da74,
|
|
|
+ IFNULL(SUM(da75), 0) as da75,
|
|
|
+ IFNULL(SUM(da76), 0) as da76,
|
|
|
+ IFNULL(SUM(da77), 0) as da77,
|
|
|
+ IFNULL(SUM(da78), 0) as da78,
|
|
|
+ IFNULL(SUM(da79), 0) as da79,
|
|
|
+ IFNULL(SUM(da80), 0) as da80,
|
|
|
+ IFNULL(SUM(da81), 0) as da81,
|
|
|
+ IFNULL(SUM(da82), 0) as da82,
|
|
|
+ IFNULL(SUM(da83), 0) as da83,
|
|
|
+ IFNULL(SUM(da84), 0) as da84,
|
|
|
+ IFNULL(SUM(da85), 0) as da85,
|
|
|
+ IFNULL(SUM(da86), 0) as da86,
|
|
|
+ IFNULL(SUM(da87), 0) as da87,
|
|
|
+ IFNULL(SUM(da88), 0) as da88,
|
|
|
+ IFNULL(SUM(da89), 0) as da89,
|
|
|
+ IFNULL(SUM(da90), 0) as da90,
|
|
|
+ IFNULL(SUM(m4), 0) as m4,
|
|
|
+ IFNULL(SUM(m5), 0) as m5,
|
|
|
+ IFNULL(SUM(m6), 0) as m6,
|
|
|
+ IFNULL(SUM(m7), 0) as m7,
|
|
|
+ IFNULL(SUM(m8), 0) as m8,
|
|
|
+ IFNULL(SUM(m9), 0) as m9,
|
|
|
+ IFNULL(SUM(m10), 0) as m10,
|
|
|
+ IFNULL(SUM(m11), 0) as m11,
|
|
|
+ IFNULL(SUM(y1), 0) as y1,
|
|
|
+ IFNULL(SUM(total), 0) as total,
|
|
|
+ IFNULL(SUM(first_role_num), 0) as first_role_num_ltv,
|
|
|
+ IFNULL(SUM(reg_user_cnt), 0) as reg_user_cnt
|
|
|
+ FROM
|
|
|
+ ads_user_role_ltv_trend
|
|
|
+ """;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private List<H5NatureUserVO> getH5NatureUserVOList(GameDataH5DTO dto, Map<String, Object> importDayNMap, GameDataH5VO item) {
|
|
|
Sql natureGameSql = Sqls.queryEntity("""
|
|
|
select
|