Questions with most View

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Questions with most Views
-- The top 50 questions with most Views 

SELECT TOP 50 Posts.id AS [Post Link],
	users.id AS [User Link],
	Posts.ViewCount,
	Posts.CreationDate,
	Posts.Score AS [Question Score],
	max(Answer.Score) AS [max Answer Score],
	Posts.FavoriteCount
FROM Posts
INNER JOIN users
	ON Posts.OwnerUserId = users.id
LEFT JOIN Posts AS Answer
	ON Answer.parentid = Posts.id
		AND Answer.posttypeid = 2
WHERE Posts.posttypeid = 1
	
GROUP BY Posts.Id,
	users.id,
	Posts.CreationDate,
	Posts.Score,
	Posts.ViewCount,
	Posts.FavoriteCount
ORDER BY Posts.ViewCount DESC

Enter Parameters

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