Ночные вопрос + репутация

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select
  DATEFROMPARTS(DATEPART(yyyy, p.CreationDate), DATEPART(mm, p.CreationDate), 1) as Month,
  sum(IIF(u.Reputation>2 and u.Reputation<=10, 1, 0)) as [2-10],
  sum(IIF(u.Reputation>10 and u.Reputation<=20, 1, 0)) as [11-20],
  sum(IIF(u.Reputation>20 and u.Reputation<=30, 1, 0)) as [21-30],
  sum(IIF(u.Reputation>30 and u.Reputation<=40, 1, 0)) as [31-40],
  sum(IIF(u.Reputation>40 and u.Reputation<=50, 1, 0)) as [41-50]
  /*sum(IIF(u.Reputation=1, 1, 0)) as [=1],
  sum(IIF(u.Reputation>1 and u.Reputation<=50, 1, 0)) as [2-50],
  sum(IIF(u.Reputation>50 and u.Reputation<=100, 1, 0)) as [51-100],
  sum(IIF(u.Reputation>100 and u.Reputation<=150, 1, 0)) as [101-150],
  sum(IIF(u.Reputation>150 and u.Reputation<=200, 1, 0)) as [151-200],
  sum(IIF(u.Reputation>200 and u.Reputation<=250, 1, 0)) as [201-250],
  sum(IIF(u.Reputation>250 and u.Reputation<=300, 1, 0)) as [251-300],
  sum(IIF(u.Reputation>300 and u.Reputation<=350, 1, 0)) as [300-351],
  sum(IIF(u.Reputation>350 and u.Reputation<=400, 1, 0)) as [351-400],
  sum(IIF(u.Reputation>400 and u.Reputation<=450, 1, 0)) as [401-450],
  sum(IIF(u.Reputation>450 and u.Reputation<=500, 1, 0)) as [451-500]*/
  /*sum(IIF(u.Reputation>500 and u.Reputation<=1000, 1, 0)) as [500-1000],
  sum(IIF(u.Reputation>1000 and u.Reputation<=1500, 1, 0)) as [1000-1500],
  sum(IIF(u.Reputation>1500 and u.Reputation<=2000, 1, 0)) as [1500-2000],
  sum(IIF(u.Reputation>2000, 1, 0)) as [>2000]*/
from Posts p join Users u on p.OwnerUserId = u.id
where PostTypeId = 1 and p.CreationDate >= Convert(datetime, '2018-03-01')
and DATEPART(hh, p.CreationDate) >= 20
group by DATEFROMPARTS(DATEPART(yyyy, p.CreationDate), DATEPART(mm, p.CreationDate), 1)
order by 1

Enter Parameters

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