SELECT b.mon, SUM(a.numRegistered) FROM ( select MONTH(...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy

Q&A for science fiction and fantasy enthusiasts

-- find out registered users every month in 2019

-- find out the total number of users registered from
-- januarary  month X, in year 2019

SELECT b.mon, SUM(a.numRegistered) FROM
(
select MONTH(CreationDate) as mon, COUNT(*) as numRegistered from Users WHERE YEAR(CreationDate) = 2019 GROUP BY MONTH(CreationDate)
) a JOIN (
  select MONTH(CreationDate) as mon, COUNT(*) as numRegistered from Users WHERE YEAR(CreationDate) = 2019 GROUP BY MONTH(CreationDate)
) b ON a.mon <= b.mon
GROUP BY b.mon ORDER BY b.mon

Enter Parameters

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