After-Closure Answers Posted By [User]

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

SELECT
  CONCAT('site://a/', a.Id, '|', q.Title) AS [Link],
  a.CreationDate AS [Answer Posted .],
  q.ClosedDate AS [Q Closed .],
  CONCAT(
    DATEDIFF(hour, q.ClosedDate, a.CreationDate), 'h ',
    DATEDIFF(minute, q.ClosedDate, a.CreationDate) % 60, 'm ',
    DATEDIFF(second, q.ClosedDate, a.CreationDate) % 60, 's')
  AS [Time After Close],
  CASE WHEN a.OwnerUserId IS NOT NULL THEN u.DisplayName ELSE a.OwnerDisplayName END AS [Answer OP]
FROM Posts a
JOIN Posts q ON q.Id = a.ParentId
LEFT JOIN Users u ON u.Id = a.OwnerUserId
WHERE a.CreationDate > q.ClosedDate 
  AND DATEDIFF(hour, q.ClosedDate, a.CreationDate) < 4
  AND a.OwnerUserId = ##UserId:int##
ORDER BY -- Order By Hours, then Minutes, then Seconds after closure
  DATEDIFF(hour, q.ClosedDate, a.CreationDate) DESC,
  DATEDIFF(minute, q.ClosedDate, a.CreationDate) % 60 DESC,
  DATEDIFF(second, q.ClosedDate, a.CreationDate) % 60 DESC

Enter Parameters

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