Users with highest number of combined Views

4

Please login or register to vote for this query.

(click on this box to dismiss)

Returns the Users with the highest number of total views for their questions

Internet of Things Meta

Q&A about the site for builders and users of networked sensors and control devices in the contexts of smart homes, industry automation, or environmental sensors

-- Users with highest number of combined Views
-- Returns the Users with the highest number of total views for their questions

DECLARE @total float

SELECT @total = Sum(ViewCount) FROM Posts WHERE PostTypeId = 1

SELECT 
  Users.Id AS [User Link],
  Sum(ViewCount) AS TotalViews,
  Count(*) AS NumberOfQuestions,
  Sum(ViewCount)/Count(*) AS AvgViewsPerQuestion,
  100 * Sum(ViewCount) / @total AS PercentOfSite
FROM Posts 
INNER JOIN Users ON Users.Id = Posts.OwnerUserId 
WHERE PostTypeId = 1 
GROUP BY Users.Id 
ORDER BY TotalViews DESC

Enter Parameters

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