select round(count(distinct b.user_id)/count(distinct a.user_id),3) as pfrom (select user_id,min(date) as date from login group by 1) as aleft joinlogin as bon a.user_id =b.user_idand datediff(b.date,a.date)=1