13.1 day retention 3 - part 3


date(g1.created_at) as dt,
round(count(distinct g2.user_id) /
count(distinct g1.user_id)*100) as retention
from gameplays as g1
left join gameplays as g2 on
g1.user_id = g2.user_id
and date(g1.created_at) = date(datetime(g2.created_at, '-1 day'))
group by 1
order by 1
limit 100;

the correct code should be roung(100*count(distinct g2.ueser_id)/count(distinct g1.user_id))
I don't understand why we should put 100* on the left side of the count(distinct g2.user_id).
If I put it on the right side of the count(distinct g1user_id),like the code I put above,the result will be all 0.
Please help me with this problem.Thank you!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.