SELECT Users.Id AS UserId, COUNT(CASE WHEN Posts.PostType...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Psychology and Neuroscience

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 >= 20000
    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;

Enter Parameters

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