Find answers to HNQ by a specific user that were posted before the question became HNQ

1

Please login or register to vote for this query.

(click on this box to dismiss)

Reverse Engineering Meta

Q&A about the site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation

declare @EndDate datetime = (select case
  -- If we request 'today', actually use the date
  -- of the most recent transfer to this database,
  -- which may be as much as a week in the past.
  when lower(##EndDate:string?today##) = 'today' then max(CreationDate)
  -- Otherwise, specify the most recent date to include.
  else ##EndDate##
  end
  from Posts
);

declare @StartDate datetime = dateadd(day, -1*##DaysBack?30##, @EndDate);

SELECT answers.Id [Post Link], answers.CreationDate as 'Answer Posted', ph.CreationDate as 'Became HNQ'
FROM PostHistory ph
INNER JOIN Posts answers ON answers.ParentId=ph.PostId
WHERE answers.OwnerUserId= ##userId##
  AND answers.CreationDate between @StartDate and @EndDate
  AND ph.PostHistoryTypeId=52
  AND answers.CreationDate < ph.CreationDate

Enter Parameters

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