zoukankan      html  css  js  c++  java
  • 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;
  • 相关阅读:
    thunkify 模块
    koa框架异步返回值的操作(co,koa-compose)
    ES6 基础版迭代器
    静态类在线程中的共享问题
    AWS远程登录
    系统状体检测命令
    常用系统命令
    文本文件查看命令
    vim
    查看md5
  • 原文地址:https://www.cnblogs.com/ldy233/p/14438331.html
Copyright © 2011-2022 走看看