Posts by day of the week (percentage)

0

Please login or register to vote for this query.

(click on this box to dismiss)

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

Science Fiction and Fantasy Meta

Q&A about the site for science fiction and fantasy enthusiasts

-- Posts by day of the week (percentage)
-- Show the percentage of new questions and answers on each day of the week (UTC).
SET DATEFIRST 1

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

Enter Parameters

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