Q&A for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry
SELECT Users.Id AS UserId, COUNT(CASE WHEN Posts.PostTypeId = 1 THEN 1 ELSE NULL END) AS NumQuestions, COUNT(CASE WHEN Posts.PostTypeId = 2 THEN 1 ELSE NULL END) AS NumAnswers, SUM(CASE WHEN Votes.VoteTypeId = 2 THEN 1 ELSE 0 END) AS Upvotes, SUM(CASE WHEN Votes.VoteTypeId = 3 THEN 1 ELSE 0 END) AS Downvotes FROM Users JOIN Posts ON Users.Id = Posts.OwnerUserId JOIN Votes ON Posts.Id = Votes.PostId WHERE Users.Reputation BETWEEN 10000 AND 19999 AND Posts.CreationDate >= '2021-01-01' AND Posts.CreationDate < '2024-01-01' -- Filter for posts created between 2018-01-01 and 2019-12-31 GROUP BY Users.Id;