Ratio of liked questions by month

0

Please login or register to vote for this query.

(click on this box to dismiss)

A question is liked, if 1) its score > 0 2) is not closed 3) is not deleted.

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

SELECT
  DATEFROMPARTS(
    DATEPART(yyyy, v.CreationDate),
    DATEPART(mm, v.CreationDate),
    1) AS Month,
  100.0 *
    COUNT(CASE
      WHEN v.votetypeid = 2 AND ClosedDate IS NULL AND DeletionDate IS NULL THEN 1
      ELSE NULL END) /
    COUNT(distinct p.id) AS Pct
FROM Posts p
inner join votes v on v.postid = p.id and votetypeid = 2
WHERE PostTypeId = 1
GROUP BY DATEFROMPARTS(
  DATEPART(yyyy, v.CreationDate),
  DATEPART(mm, v.CreationDate),
  1)
ORDER BY Month DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results