SELECT u.Id AS [User Link], SUM(p.ViewCount) AS "Views", ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Japanese Language

Q&A for students, teachers, and linguists wanting to discuss the finer points of the Japanese language

SELECT
  u.Id AS [User Link],
  SUM(p.ViewCount) AS "Views",
  SUM(CASE WHEN v.VoteTypeId = 2 AND p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "QUpVotesReceived",
  SUM(CASE WHEN v.VoteTypeId = 3 AND p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "QDownVotesReceived",
  SUM(CASE WHEN v.VoteTypeId = 2 AND p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "AUpVotesReceived",
  SUM(CASE WHEN v.VoteTypeId = 3 AND p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "ADownVotesReceived"
FROM
  Users AS u
  INNER JOIN Posts AS p
    ON u.Id = p.OwnerUserId
  INNER JOIN Votes AS v
    ON p.Id = v.PostId
GROUP BY
  u.Id

Enter Parameters

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