Most viewed question vs. sum of views

0

Please login or register to vote for this query.

(click on this box to dismiss)

Sports

Q&A for participants in team and individual sport activities

SELECT
  CAST(p.CreationDate AS Date),
  MAX(p.ViewCount) AS [Maximum],
  SUM(p.ViewCount) AS [Sum],
  COUNT(p.Id) As [Count],
  ROUND((MAX(p.ViewCount))*100.0/(SUM(p.ViewCount)),2) AS [Percentage]
FROM Posts p 
WHERE (p.PostTypeId=1) 
   AND (p.CreationDate >= '##Date1?2020-01-01##') AND (p.CreationDate <= '##Date2?2021-01-01##')
GROUP BY CAST(p.CreationDate AS Date)
ORDER BY CAST(p.CreationDate AS Date)

Enter Parameters

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