Usuários por mês

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow em Português

Perguntas e respostas para programadores profissionais e entusiastas

SELECT 
CONVERT(DATETIME, CONCAT(YEAR(CreationDate), '-', MONTH(CreationDate), '-01'), 20) AS Mes,
-- COUNT(*) AS Usuarios
(SELECT COUNT(*) FROM Users u WHERE YEAR(u.CreationDate) <= YEAR(Users.CreationDate) AND MONTH(u.CreationDate) <= MONTH(Users.CreationDate) ) AS Usuarios
FROM Users

GROUP BY YEAR(CreationDate), MONTH(CreationDate)
ORDER BY YEAR(CreationDate), MONTH(CreationDate)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results