select Id [Post Link], NextBumpEligible = LastActivityDat...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Robotics

Q&A for professional robotic engineers, hobbyists, researchers and students

select Id [Post Link],
  NextBumpEligible = LastActivityDate + iif(LastActivityUserId <> -1, 30, 120)
from
(
  SELECT p.Id,
    LastActivityDate = (select max(h.CreationDate)
    from PostHistory h join Posts hp on hp.Id = h.PostId
      and isnull(hp.ParentId, h.PostId) = p.Id
    where PostHistoryTypeId in (1,2,3,4,5,6,7,8,9,10,11,50)),
    LastActivityUserId = (select top 1 UserId
    from PostHistory h join Posts hp on hp.Id = h.PostId
      and isnull(hp.ParentId, h.PostId) = p.Id
    where PostHistoryTypeId in (1,2,3,4,5,6,7,8,9,10,11,50)
    order by h.CreationDate desc)
  FROM Posts p 
  WHERE p.PostTypeId = 1
  AND p.ClosedDate IS NULL
  AND p.AcceptedAnswerId is null
  AND (select MAX(Score) from Posts a where a.ParentId = p.Id) = 0
  AND p.Score >= 0
) x
order by 2

Enter Parameters

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