https://leetcode-cn.com/problems/game-play-analysis-v/
1097.pngselect
c.min_date install_dt
,c.installs installs
,if(c.retention=0,0.00,round(c.retention/c.installs,2))Day1_retention
from(
select
a.min_date
,count(a.player_id) installs
,sum(case when b.event_date is not null then 1 else 0 end)retention
from(
select player_id,min(event_date) min_date from Activity group by player_id
)a left join Activity b on (DATE_ADD(a.min_date,INTERVAL 1 DAY)=b.event_date and a.player_id=b.player_id)
group by a.min_date
order by a.min_date
)c
网友评论