Q&A for active researchers, academics and students of physics
-- Minimum number of answers a user must have written to be included.
DECLARE @MinAnswers int = ##MinAnswers##
Users.Id AS [User Link],
SUM(Posts.Score) AS "Total upvotes",
COUNT(*) AS "Total answers",
1.0 * SUM(Posts.Score) / COUNT(*) AS "Ave. score",
MAX(Posts.Score) AS "Highest score",
1.0 * MAX(Posts.Score) / SUM(Posts.Score) AS "Faction votes from highest"
FROM Posts LEFT JOIN Users
ON Posts.OwnerUserId = Users.Id
WHERE Posts.PostTypeId = 2
GROUP BY Users.Id
HAVING COUNT(*) >= @MinAnswers
ORDER BY "Ave. score" DESC