Posts by day of the week

0

Please login or register to vote for this query.

(click on this box to dismiss)

Show the number of new questions and answers on each day of the week (UTC).

Mathematics

Q&A for people studying math at any level and professionals in related fields

-- Posts by day of the week
-- Show the number of new questions and answers on each day of the week (UTC).

SELECT
    Min(pt.Name) As [Type],
    Sum(CASE DatePart(Weekday, p.CreationDate) WHEN 1 THEN 1 ELSE 0 END) As [Monday],
    Sum(CASE DatePart(Weekday, p.CreationDate) WHEN 2 THEN 1 ELSE 0 END) As [Tuesday],
    Sum(CASE DatePart(Weekday, p.CreationDate) WHEN 3 THEN 1 ELSE 0 END) As [Wednesday],
    Sum(CASE DatePart(Weekday, p.CreationDate) WHEN 4 THEN 1 ELSE 0 END) As [Thursday],
    Sum(CASE DatePart(Weekday, p.CreationDate) WHEN 5 THEN 1 ELSE 0 END) As [Friday],
    Sum(CASE DatePart(Weekday, p.CreationDate) WHEN 6 THEN 1 ELSE 0 END) As [Saturday],
    Sum(CASE DatePart(Weekday, p.CreationDate) WHEN 7 THEN 1 ELSE 0 END) As [Sunday]
FROM Posts p
INNER JOIN PostTypes pt
  ON pt.Id = p.PostTypeId
GROUP BY p.PostTypeId
ORDER BY p.PostTypeId

Enter Parameters

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