Date of first questions 2017

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

-- How many first questions by users were asked on each weekday of 2017?
select CAST(Posts.CreationDate AS DATE) as asked, count(1) as questions
from (
  select Min(Id) as Id, OwnerUserId
  from Posts
  where PostTypeId = 1
  group by OwnerUserId
) temp, Posts
where temp.Id = Posts.Id
  and CAST(Posts.CreationDate AS DATE) between '01/01/2017' and '01/01/2018'
  and DATEPART(dw,CAST(Posts.CreationDate AS DATE)) in (2, 3, 4, 5, 6)
group by CAST(Posts.CreationDate AS DATE)
order by CAST(Posts.CreationDate AS DATE)

Enter Parameters

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