SELECT u.Id, u.Id AS [User Link], u.Reputation, u.Upvotes...

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
  u.Id,
  u.Id AS [User Link],
  u.Reputation,
  u.Upvotes,
  u.Downvotes,
  (
    SELECT count(p.Id) FROM Posts p WHERE u.Id = p.OwnerUserId AND PostTypeId = 1
  ) AS [Posted Questions],
  (
    SELECT count(p.Id) FROM Posts p WHERE u.Id = p.OwnerUserId AND PostTypeId = 2
  ) AS [Posted Answers],
  (
    SELECT count(b.Id) FROM Badges b WHERE u.Id = b.UserId AND b.Class = 1
  ) AS [Golden Badges],
  (
    SELECT count(b.Id) FROM Badges b WHERE u.Id = b.UserId AND b.Class = 2
  ) AS [Silver Badges],
  (
    SELECT count(b.Id) FROM Badges b WHERE u.Id = b.UserId AND b.Class = 3
  ) AS [Bronze Badges]
FROM Users AS u
ORDER BY u.Reputation DESC
/* WHERE u.Reputation > 2000 */

Enter Parameters

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