Select top posts and answers by tag

1

Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles Meta

Q&A about the site for people who build and repair bicycles, people who train cycling, or commute on bicycles

DECLARE @Tag VARCHAR(35) = ##Tag:string?javascript##;

SELECT 
  Posts.Id
INTO #Temp
FROM 
  Posts 
  INNER JOIN PostTags ON Posts.Id = PostTags.PostId 
  INNER JOIN Tags ON Tags.Id = PostTags.TagId 
WHERE 
  lower(Tags.TagName) = lower(@Tag);

SELECT TOP 10000
  'https://stackoverflow.com/q/' + cast(Id as varchar(15)) Url, 
  Title, 
  Score 
FROM 
  Posts 
WHERE 
  Id in (SELECT Id FROM #Temp)
  or ParentId in (Select Id From #Temp)
ORDER BY 
  Score DESC

Enter Parameters

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