Window function- MS SQL SOLUTION
\nSELECT cast(cast(sum(case when abs(DATEDIFF(DAY, event_date, first_login)) =1 then 1 else 0 end) as numeric)/\ncast(count(distinct player_id) as numeric) as n
```\nSELECT cast(cast(sum(case when abs(DATEDIFF(DAY, event_date, first_login)) =1 then 1 else 0 end) as numeric)/\ncast(count(distinct player_id) as numeric) as numeric(6,2)) as fraction\n\nFROM\n(\nSELECT *,\nMIN(EVENT_DATE) OVER(PARTITION BY PLAYER_ID) AS first_login\nFROM ACTIVITY) AS t\n\n\n```
[]