Find posts by tags and order by views

0

Please login or register to vote for this query.

(click on this box to dismiss)

Webmasters

Q&A for pro webmasters

DECLARE @NumberOfRows int = ##NumberOfRows##

SELECT Top ##NumberOfRows##
  Posts.Id AS Id
  , Posts.CreationDate AS CreationDate
  , Posts.Title AS Title
  , Posts.Score AS Score
  , Posts.ViewCount AS Views
  , Posts.AnswerCount AS AnswerCount
  , Posts.CommentCount AS CommentCount
  , Posts.FavoriteCount AS FavoriteCount
  , Posts.Tags AS Tags
  
FROM
  Tags
  JOIN PostTags ON PostTags.TagId = Tags.Id
  JOIN Posts ON Posts.Id = PostTags.PostId
  
WHERE
  Tags.TagName COLLATE SQL_Latin1_General_CP1_CI_AS LIKE ##EnterKeyword:string##
  AND Posts.PostTypeId = 1
  AND Posts.CommentCount >10
  AND Posts.AnswerCount >10
  AND Posts.FavoriteCount >10
  
--ORDER BY
  --Score DESC
  
-- NumberOfRows: Number of Records
-- EnterKeyword: Enter tag or keyword

Enter Parameters

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