Total View Count of User's Accepted Answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

SELECT 'Grand Total' AS Title, SUM(Question.ViewCount) AS ViewCount, MIN(Answer.CreationDate), SUM(Answer.Score) AS Score

FROM Posts AS Answer
  INNER JOIN PostTypes ON PostTypes.Id = Answer.PostTypeId
  INNER JOIN Posts AS Question ON Question.Id = Answer.ParentId

WHERE
  PostTypes.Name = 'Answer' AND
  Answer.OwnerUserId = ##UserId## AND
  Answer.CommunityOwnedDate IS NULL AND
  Answer.CreationDate >= 2023-04-01 AND
  Question.CreationDate >= 2023-04-01

UNION ALL

SELECT
  Question.Title, Question.ViewCount, Answer.CreationDate, Question.Score

FROM Posts AS Answer
  INNER JOIN PostTypes ON PostTypes.Id = Answer.PostTypeId
  INNER JOIN Posts AS Question ON Question.Id = Answer.ParentId

WHERE
  PostTypes.Name = 'Answer' AND
  Answer.OwnerUserId = ##UserId## AND
  Answer.CommunityOwnedDate IS NULL AND
  Answer.CreationDate >= 2023-04-01 AND
  Question.CreationDate >= 2023-04-01
  
ORDER BY
  ViewCount DESC

Enter Parameters

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