Posts by Tag

1

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers

Q&A for Drupal developers and administrators

/* Input string for matching tag */
DECLARE @Tag1 nvarchar(max) = ##Tag1:string##

SELECT 
CAST(YEAR(CreationDate) AS VARCHAR(4)) + '-' + CAST(MONTH(CreationDate) AS VARCHAR(2)) AS QuestionCreated,
COUNT(*) as QuestionPosts,
SUM(Posts.Score) as QuestionScores,
SUM(Posts.ViewCount) as QuestionViews,
SUM(Posts.AnswerCount) as QuestionAnswers
FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.Id = PostTags.PostId
where tagname = @Tag1
GROUP BY CAST(YEAR(CreationDate) AS VARCHAR(4)) + '-' + CAST(MONTH(CreationDate) AS VARCHAR(2))

Enter Parameters

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