declare @start datetime, @total float select @start = ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity Meta

Q&A about the site for committed Christians, experts in Christianity and those interested in learning more

-- Users by Time Zone
-- Number of users by timezone who have visited the site in the past day


declare @start datetime, @total float

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

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

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

Enter Parameters

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