My HNQs

0

Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles

Q&A for people who build and repair bicycles, people who train cycling, or commute on bicycles

DECLARE @UserId INT = ##UserId##;

SELECT hnq.PostId AS [Post Link],
  p.PostTypeId,
  u.DisplayName AS [User Link],
  hnq.CreationDate,
  nhnq.CreationDate
FROM PostHistory AS hnq
INNER JOIN Posts AS p
ON hnq.PostId = p.Id
INNER JOIN Users AS u
ON p.OwnerUserId = u.Id
LEFT OUTER JOIN PostHistory AS nhnq
ON hnq.PostId = nhnq.PostId
AND nhnq.PostHistoryTypeId = 53
WHERE u.Id = @UserId
AND hnq.PostHistoryTypeId = 52;

/*
SELECT DISTINCT p.Id AS [Post Link],p.PostTypeId,u.DisplayName AS [User Link], p.CreationDate
FROM Posts p
JOIN Users u ON p.OwnerUserId = u.Id
JOIN PostHistory ph ON p.Id = ph.PostId
WHERE (OwnerUserId = @UserId) AND (ph.PostHistoryTypeId = 52)
ORDER BY p.Id ASC
*/

Enter Parameters

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