Q&A about the site for engineers, scientists, programmers, and computing professionals interested in quantum computing
SELECT q.OwnerUserId AS UserID, SUM(q.Score + a.Score) AS TotalGainedUpvotes FROM Posts AS q JOIN Posts AS a ON q.Id = a.ParentId WHERE q.PostTypeId = 1 -- 1 indicates questions AND a.PostTypeId = 2 -- 2 indicates answers AND q.OwnerUserId = a.OwnerUserId -- same User ID AND DATEDIFF(second, q.CreationDate, a.CreationDate) < 3 -- answered themselves in less than 3 seconds GROUP BY q.OwnerUserId ORDER BY TotalGainedUpvotes DESC -- Order by TotalGainedUpvotes in descending order