DECLARE @MaxAnswerCount INT = ##MaxAnswerCount##;
DECLARE @MinQuestionScore INT = ##MinQuestionScore##;
WITH QuestionsToAnswer AS (
SELECT
Id AS [Post Link]
, Id
, Score
, ViewCount
FROM Posts WHERE
PostTypeId = 1 AND
Score >= @MinQuestionScore AND
AnswerCount <= @MaxAnswerCount
)
SELECT * FROM QuestionsToAnswer UNION
SELECT
COUNT([Post Link])
, COUNT(Id)
, COUNT(Score)
, COUNT(ViewCount)
FROM QuestionsToAnswer;