MYSQL simple solution using lead
Simple solution using lead window function\n\nselect\n    round(count(player_id) /  (select count(distinct player_id) from activity), 2) as fraction\nfrom (\n  
Simple solution using lead window function\n```\nselect\n    round(count(player_id) /  (select count(distinct player_id) from activity), 2) as fraction\nfrom (\n    select\n        player_id,\n        event_date,\n        row_number() over (partition by player_id order by event_date asc) as login_rank,\n        lead(event_date) over (partition by player_id order by event_date asc) as next_login\n    from\n        activity\n) login_table\nwhere \n login_table.login_rank = 1 and\n login_table.next_login is not null and\n datediff(login_table.next_login, login_table.event_date) = 1\n```
[]