select round(count(distinct case when datediff(b.date, a.date) = 1
then a.user_id end)
/ count(distinct a.user_id),3) p
from login a join login b
on a.user_id = b.user_id;
select round(count(distinct case when datediff(b.date, a.date) = 1
then a.user_id end)
/ count(distinct a.user_id),3) p
from login a join login b
on a.user_id = b.user_id;