Posts that are one upvote away from earning you "Necromancer"

2

Please login or register to vote for this query.

(click on this box to dismiss)

Returns a list of questions for a given user that have 4 upvotes and are at least 60 days old, meaning the next upvote on any of the posts will earn the user a Necromancer badge.

SharePoint

Q&A for SharePoint enthusiasts

-- Posts that are one upvote away from earning you "Necromancer"
-- Returns a list of questions for a given user that have 4 upvotes and are at least 60 days old, meaning the next upvote on any of the posts will earn the user a Necromancer badge.

declare @userId int = ##userId##

select
    p.ParentId as [Post Link]
   ,datediff(day, parent.CreationDate, p.CreationDate) as [Days after Ask for Answer]
   ,count(*) as voteCount
from
    Posts p         
    inner join Votes v
        on v.PostId = p.Id
        and v.VoteTypeId = 2
     inner join Posts parent
        on parent.Id = p.ParentId
where
    p.OwnerUserId = @userId
    and datediff(day, parent.CreationDate, p.CreationDate) >= 60
group by
    p.ParentId
   ,p.Id
   ,datediff(day, parent.CreationDate, p.CreationDate)
having
    count(*) = 4
order by
    datediff(day, parent.CreationDate, p.CreationDate) desc
   

Enter Parameters

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