Get Users Who Accept Answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts Meta

Q&A about the site for enthusiasts and power users of the Android operating system

SELECT u.Id, 
  SUM(CASE WHEN (q.AcceptedAnswerId = a.Id) THEN 1 END) as number_accepted,
  COUNT(DISTINCT(q.Id)) as total_number
FROM Users u
INNER JOIN Posts q
ON (
  q.OwnerUserId = u.Id AND
  q.PostTypeId = 1 AND
  u.CreationDate > '2020-01-01'
)
INNER JOIN Posts a
ON (
  a.ParentId = q.Id
)
GROUP BY u.Id
ORDER BY total_number DESC;

Enter Parameters

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