Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Consulta SQL para contar usuários registrados por dia

SELECT date(user.created_at) as "creation_date", count(user.user_id) as "user_total"
FROM application a
INNER JOIN user u ON a.application_id = u.application_id 
WHERE date(user.created_at) <= '2012-02-01'
AND ((date(user.deleted_at) > '2012-02-01') or (user.deleted_at is null))
GROUP BY date(user.created_at)
ORDER BY date(user.created_at) ASC