Highest question to view ratio by user

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

SELECT TOP 20
  p.OwnerUserId AS [User Link], 
  sum(p.ViewCount) AS [Total Views],
  count(p.Id) AS [Total Questions],
  sum(p.ViewCount)/count(p.Id) AS [View Count Ratio],
  (SELECT TOP 1 Id FROM Posts WHERE ViewCount = max(p.ViewCount)) AS [Post Link]
  --sum(CASE WHEN ViewCount > 10000 THEN p.ViewCount ELSE 0 END) AS [Total Famous Views],
  --count(CASE WHEN ViewCount > 10000 THEN p.Id ELSE NULL END) AS [Total Famous Questions],
  --sum(CASE WHEN ViewCount > 10000 THEN p.ViewCount ELSE 0 END) /
  --  count(CASE WHEN ViewCount > 10000 THEN p.Id ELSE NULL END) AS [Famous View Count Ratio]
FROM Posts p
WHERE p.PostTypeId = 1 AND ViewCount > 10000
GROUP BY p.OwnerUserId
ORDER BY sum(p.ViewCount) DESC

Enter Parameters

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