SELECT
a.date,
ROUND( COUNT( b.user_id ) * 1.0 / COUNT( a.user_id ), 3 ) AS p
FROM
( SELECT user_id, MIN( date ) AS date FROM login GROUP BY user_id ) a
LEFT JOIN login b ON a.user_id = b.user_id
AND b.date = date( a.date, '+1 day' )
GROUP BY
a.date UNION
SELECT
date,
0.000 AS p
FROM
login
WHERE
date NOT IN ( SELECT MIN( date ) FROM login GROUP BY user_id )
ORDER BY
date