Percentage of liked questions per day

1

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity

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

SELECT
  DATEFROMPARTS(
    DATEPART(yyyy, CreationDate),
    DATEPART(mm, CreationDate),
    DATEPART(d, CreationDate)) AS Day,
  COUNT(*) AS [All Questions],
  COUNT(CASE WHEN Score > 0 AND ClosedDate IS NULL AND DeletionDate IS NULL
    THEN 1 ELSE NULL END) AS [Liked Questions],
  100.0 * COUNT(
    CASE WHEN Score > 0 AND ClosedDate IS NULL AND DeletionDate IS NULL
    THEN 1 ELSE NULL END) / COUNT(*) AS [Percent]
  /*
  COUNT(*) AS [All Questions],
  COUNT(COALESCE(ClosedDate, DeletionDate)) AS [Closed Questions],
  COUNT(DeletionDate) AS [Deleted Questions]
  */
FROM PostsWithDeleted
WHERE PostTypeId = 1
GROUP BY 
  DATEFROMPARTS(
    DATEPART(yyyy, CreationDate),
    DATEPART(mm, CreationDate),
    DATEPART(d, CreationDate))
ORDER BY Day DESC

Enter Parameters

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