Select recent posts & answers from tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Engineering

Q&A for professionals and students of engineering

DECLARE @tag VARCHAR(10) = '<' + ##Tag:string## + '>';
DECLARE @startdate DATETIME = '##StartDate##';
DECLARE @enddate DATETIME = '##EndDate##';


WITH [CTE] AS (
  SELECT * FROM Posts WHERE CHARINDEX(@tag, Tags)>0 AND CreationDate > @startdate
  AND CreationDate <= @enddate
  UNION ALL
  SELECT Posts.* FROM Posts JOIN [CTE] on Posts.ParentId = [CTE].Id
)

SELECT * FROM [CTE] ORDER BY Id
;

Enter Parameters

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