Most viewed questions for a tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Robotics Meta

Q&A about the site for professional robotic engineers, hobbyists, researchers and students

-- Most viewed questions for a tag

DECLARE @Tag NVARCHAR(200) = ##Tag:string##

SELECT TOP 20
    'https://stackoverflow.com/questions/' + CAST(Posts.Id as varchar(10)) AS Url
    , Posts.Title
    , Posts.ViewCount
    , Posts.Tags
    , Posts.Score
    , Posts.AnswerCount
FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.Id = PostTags.PostId
WHERE
    PostTypeId = 1
    AND TagName = @Tag
ORDER BY ViewCount DESC

Enter Parameters

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