What are my posts relevant for getting the Unsung Hero badge?

1

Please login or register to vote for this query.

(click on this box to dismiss)

This query shows all answer posts which are relevant for the "Unsung Hero" badge sorted by the creation date. In addition it shows if a post is already counting (older than 10 days) or not.

Stack Apps

Q&A for apps, scripts, and development with the Stack Exchange API

-- What are my answer posts counting for unsung hero badge?
-- The CreationDate has to be 10 days old, but this query
--     does not filter by creation date to get a nice overview
--     about all posts which will count in future (sort by date)

DECLARE @UserId int = ##UserId##

SELECT
    a.Id AS [Post Link],
    a.CreationDate AS [Answer Creation Date],
    (case when datediff(dd, a.CreationDate, getdate()) < 10 then 0 else 1 end) AS [10 days criterion met]
FROM
    Posts q
  INNER JOIN
    Posts a
  ON a.Id = q.AcceptedAnswerId
WHERE
      a.CommunityOwnedDate is null
  and a.OwnerUserId = @UserId
  and q.OwnerUserId != @UserId
  and a.postTypeId = 2
  and a.Score = 0
ORDER BY a.CreationDate DESC

Enter Parameters

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