SQL problem - Game Play Analysis IV
Problem
Query
WITH first_date_table AS (
SELECT
MIN(event_date) AS first_date, player_id
FROM
Activity
GROUP BY
player_id
)
SELECT
ROUND(
(
SELECT
COUNT(*)
FROM
Activity AS a
JOIN
first_date_table AS f
ON
a.player_id = f.player_id AND a.event_date = DATE_ADD(f.first_date, INTERVAL 1 DAY)
) / count(DISTINCT player_id), 2
) AS fraction
FROM
Activity