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

Q&A for professional and enthusiast programmers

--WITH mensal AS (
  SELECT 
    CONVERT(DATETIME, CONCAT(YEAR(CreationDate), '-', MONTH(CreationDate), '-01'), 20) AS Mes,
    COUNT(*) AS Novos
  FROM Users
  GROUP BY YEAR(CreationDate), MONTH(CreationDate)
  ORDER BY Mes
--)
--SELECT 
--  mensal.Mes,
--  mensal.Novos,
--  COUNT(Users.Id) AS Acumulado
--FROM mensal
--  INNER JOIN Users
--  ON CONVERT(DATETIME, CONCAT(YEAR(CreationDate), '-', MONTH(CreationDate), '-01'), 20) <= mensal.Mes
--
--GROUP BY mensal.Mes, mensal.Novos
--ORDER BY mensal.Mes

Enter Parameters

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