DECLARE @TagName varchar(128) = '%##TagName##%' SELECT C...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity

Q&A for committed Christians, experts in Christianity and those interested in learning more

DECLARE @TagName varchar(128) = '%##TagName##%'

    SELECT COUNT(*) AS Questions from Posts P
    WHERE P.Id IN (
      SELECT DISTINCT(PostId) from PostTags 
      WHERE PostTags.TagId In (
        SELECT Id From Tags Where TagName LIKE @TagName
      )
    )

    SELECT COUNT(*) AS 'Amount of completed questions' from Posts P
    WHERE P.Id IN (
      SELECT DISTINCT(PostId) from PostTags 
      WHERE PostTags.TagId In (
        SELECT Id From Tags Where TagName LIKE @TagName
      )
    ) AND P.AcceptedAnswerId IS NOT NULL

    SELECT SUM(P.AnswerCount) AS 'Amount of answers' from Posts P
    WHERE P.Id IN (
      SELECT DISTINCT(PostId) from PostTags 
      WHERE PostTags.TagId In (
        SELECT Id From Tags Where TagName LIKE @TagName
      )
    )

Enter Parameters

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