Posts with many "thank you" answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Now let's personalize things.  This query finds questions asked by a given
-- user, looks at the answers on those questions, and reports the score and 
-- the user who answered, ordered by user.

-- p = posts (limited to questions), a = answers on those posts (via the first
-- JOIN), au = the user who answered (via the second JOIN).

SELECT SUM(a.Score), au.DisplayName

FROM Posts p 
JOIN Posts a ON p.Id = a.ParentId
JOIN Users au ON a.OwnerUserId = au.Id

WHERE p.PostTypeId = 1
  AND p.OwnerUserId = ##UserId##

GROUP BY au.DisplayName
ORDER BY SUM(a.Score) DESC

Enter Parameters

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