Users with reputation > 10000 and < 20 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

SELECT
    Users.Id AS [User Link],
    Users.DisplayName,
    Users.Reputation,
    SUM(Case when Posts.PostTypeId = 1 then 1 else 0 end) As Questions,
    SUM(Case when Posts.PostTypeId = 2 then 1 else 0 end) As Answers,
    Users.Upvotes,
    Users.Downvotes
FROM Users
inner join Posts on Users.Id = Posts.OwnerUserId
    and (Posts.PostTypeId = 1 OR Posts.PostTypeId = 2)
    and Users.Reputation > 10000
GROUP BY
   Users.Id,
   Users.CreationDate,
   Users.LastAccessDate,
   Users.Reputation,
   Users.DisplayName,
   Users.CreationDate,
   Users.Views,
   Users.Upvotes,
   Users.Downvotes
HAVING SUM(Case when Posts.PostTypeId = 2 then 1 else 0 end) < 20
ORDER BY Users.Id ASC

Enter Parameters

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