• ads_user_retention_day_rate


    近3天新增用户留存率

    insert into table ads_user_retention_day_rate 
    select 
        '2020-03-10',--统计日期 
        date_add('2020-03-10',-1),--新增日期 
        1,--留存天数 
        sum(if(login_date_first=date_add('2020-03-10',-1) and login_date_last='2020-03-10',1,0)),--2020-03-09 的 1 日留存数 
        sum(if(login_date_first=date_add('2020-03-10',-1),1,0)),--2020-03-09 新增 
        sum(if(login_date_first=date_add('2020-03-10',-1) and login_date_last='2020-03-10',1,0))/sum(if(login_date_first=date_add('2020-03-10',- 1),1,0))*100 
    from dwt_uv_topic
    
    union all 
    select 
        '2020-03-10',--统计日期 
        date_add('2020-03-10',-2),--新增日期 
        2,--留存天数 
        sum(if(login_date_first=date_add('2020-03-10',-2) and login_date_last='2020-03-10',1,0)),--2020-03-08 的 2 日留存数 
        sum(if(login_date_first=date_add('2020-03-10',-2),1,0)),--2020-03-08 新增 
        sum(if(login_date_first=date_add('2020-03-10',-2) and login_date_last='2020-03-10',1,0))/sum(if(login_date_first=date_add('2020-03-10',- 2),1,0))*100 
    from dwt_uv_topic
    
    union all 
    select 
        '2020-03-10',--统计日期 
        date_add('2020-03-10',-3),--新增日期 
        3,--留存天数 
        sum(if(login_date_first=date_add('2020-03-10',-3) and login_date_last='2020-03-10',1,0)),--2020-03-07 的 3 日留存数 
        sum(if(login_date_first=date_add('2020-03-10',-3),1,0)),--2020-03-07 新增 
        sum(if(login_date_first=date_add('2020-03-10',-3) and login_date_last='2020-03-10',1,0))/sum(if(login_date_first=date_add('2020-03-10',- 3),1,0))*100 
    from dwt_uv_topic;
  • 相关阅读:
    C++中的new、operator new与placement new
    Eigen教程(11)
    Eigen教程(10)
    Eigen教程(9)
    Eigen教程(8)
    Eigen教程(5)
    Eigen教程(4)
    Eigen教程(3)
    makefile:n: *** missing separator. Stop
    jenkins X实践系列(3) —— jenkins X 安装拾遗
  • 原文地址:https://www.cnblogs.com/ldy233/p/14438331.html
Copyright © 2020-2023  润新知