Me vs other user


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT qu.Id AS [Post Link]
     , CONCAT('site://a/', ma.Id, '|', ma.Id) AS [MY Answer]
     , ma.Score AS [MY Score]
     , CASE WHEN qu.AcceptedAnswerId = ma.Id THEN 'Y' END AS [MY Accepted]
     , CONCAT('site://a/', oa.Id, '|', oa.Id) AS [OU Answer]
     , oa.Score AS [OU Score]
     , CASE WHEN qu.AcceptedAnswerId = oa.Id THEN 'Y' END AS [OU Accepted]
FROM       Posts AS ma
INNER JOIN Posts AS qu ON ma.ParentId = qu.Id
INNER JOIN Posts AS oa ON qu.Id = oa.ParentId AND ma.Id <> oa.Id
WHERE ma.PostTypeId = 2
AND   ma.OwnerUserId = ##UserId##
AND   oa.OwnerUserId = ##OtherUserId##

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results