Find the longest-living answer on the Overlapping Polyglots challenge

0

Please login or register to vote for this query.

(click on this box to dismiss)

Programming Puzzles and Code Golf

Q&A for programming puzzle enthusiasts and code golfers

declare @answerType tinyint;
SELECT TOP 1 @answerType = Id FROM PostTypes WHERE Name = 'Answer';
SELECT Id as [Post Link],
       OwnerUserId as [User Link],
       Score,
       CreationDate, DATEDIFF(HOUR, Posts.CreationDate,
       LEAD(Posts.CreationDate, 1, GETDATE())
    OVER (PARTITION BY ParentId, PostTypeId ORDER BY CreationDate))
    AS SurvivalTime
  FROM Posts
  WHERE PostTypeId = @answerType
    AND ParentId = 171884
  ORDER BY CreationDate ;

Enter Parameters

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