ELL Year 1 month-to-month cumulative answers by unlined User

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow en español

Preguntas y respuestas para programadores y profesionales de la informática

declare @ld0 as date = '2013-01-30'; -- Private Beta
declare @ld1 as date = '2013-02-27'; -- Jan-Feb 
declare @ld2 as date = '2013-03-30'; -- Feb-Mar
declare @ld3 as date = '2013-04-29'; -- Mar-Apr
declare @ld4 as date = '2013-05-30'; -- Apr-May
declare @ld5 as date = '2013-06-29'; -- May-Jun
declare @ld6 as date = '2013-07-30'; -- Jun-Jul
declare @ld7 as date = '2013-08-30'; -- Jul-Aug
declare @ld8 as date = '2013-09-29'; -- Aug-Sep
declare @ld9 as date = '2013-10-30'; -- Sep-Oct
declare @ld10 as date = '2013-11-29'; -- Oct-Nov
declare @ld11 as date = '2013-12-30'; -- Nov-Dec
declare @ld12 as date = '2014-01-30'; -- Dec-Jan

select
  OwnerDisplayName, 
  (select count(Id) from Posts p where CreationDate <= @ld0) as PrB,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld1) as M01,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld2) as M02,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld3) as M03,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld4) as M04,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld5) as M05,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld6) as M06,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld7) as M07,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld8) as M08,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld9) as M09,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld10) as M10,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld11) as M11,
  (select count(Id) from Posts p where PostTypeId=2 and p.CreationDate <= @ld12) as M12

from Posts p 
where OwnerUserId is null and p.PostTypeId=2 
group by  OwnerDisplayName 
order by OwnerDisplayName

Enter Parameters

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