LeetCode--1097. 游戏玩法分析 V

   日期:2020-11-08     浏览:100    评论:0    
核心提示:drop table if EXISTS Activity;create table Activity(player_id int,device_id int,event_date date,games_played int );insert into Activity values(1, 2, '2016-03-01', 5);insert into Activity values(1, 2, '2016-03-02', 6);insert into Activity values(..


drop table if EXISTS Activity;
create table Activity(
player_id int,
device_id int,
event_date date,
games_played int 
);
insert into Activity values(1, 2, '2016-03-01', 5);
insert into Activity values(1, 2, '2016-03-02', 6);
insert into Activity values(2, 3, '2017-06-25', 1);
insert into Activity values(3, 1, '2016-03-01', 0);
insert into Activity values(3, 4, '2016-07-03', 5);
select a1.install_dt,
       count(1) installs,
       round(count(a2.event_date)/count(*),2) Day1_retention
from(
		-- 算出每个人的安装日期
    select player_id,min(event_date) install_dt
    from Activity
    group by player_id
) a1
left join Activity a2
		-- 根据条件安装日期后一天登录为重新登录
    on a1.player_id = a2.player_id and datediff(a2.event_date,a1.install_dt)=1
group by a1.install_dt
 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服