Users with at least "minAnswers" answers, all scoring at least "minScore"

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

SELECT uu.Id AS [User Link], aCt.aCt AS NumAnswers
FROM Users uu
INNER JOIN
  (SELECT uuu.Id, COUNT(*) AS aCt
   FROM Posts pp
   INNER JOIN Users uuu ON pp.OwnerUserId=uuu.Id
   WHERE pp.PostTypeId=2
   GROUP BY uuu.Id
  ) AS aCt ON uu.Id=aCt.Id
WHERE uu.Id NOT IN 
  (SELECT u.Id
   FROM Posts p
   INNER JOIN Users u ON p.OwnerUserId=u.Id
   WHERE p.Score < ##minScore## AND p.PostTypeId=2) AND
  aCt.aCt >= ##minAnswers##

Enter Parameters

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