Posts by day of the week

0

Please login or register to vote for this query.

(click on this box to dismiss)

The number of posts in the last year occuring on each day of the week

SharePoint

Q&A for SharePoint enthusiasts

-- Posts by day of the week
-- The number of posts in the last year occuring on day of the week

declare @start datetime, @total float

select @start = dateadd(d, -364, max(CreationDate))
from posts

select @total = count(*)
from posts
where CreationDate > @start

select datename(dw, CreationDate) day, count(*) posts, convert(varchar(6), round((count(*) / @total) * 100, 2)) + '%' pct
from posts
where creationDate > @start
group by datename(dw, CreationDate)
order by count(*)

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results