My Punchcard

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping Meta

Q&A about the site for gardeners and landscapers

select hh,
       sum (case when dw=1 then c else 0 end) monday,
       sum (case when dw=2 then c else 0 end) tuesday,
       sum (case when dw=3 then c else 0 end) wednesday,
       sum (case when dw=4 then c else 0 end) thursday,
       sum (case when dw=5 then c else 0 end) friday,
       sum (case when dw=6 then c else 0 end) saturday,
       sum (case when dw=7 then c else 0 end) sunday,
       cast(sum(c) as float)/7.0 overall
from
(
select datepart(dw,p.CreationDate) dw,
       cast(datename(hh,p.CreationDate) as int) hh,
       count(*) c
from Posts p
where p.OwnerUserId = ##UserId##
group by datepart(dw,p.CreationDate), datename(hh,p.CreationDate)
) X
group by hh

Enter Parameters

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