Q&A for science fiction and fantasy enthusiasts
SELECT TOP 1000 u.Reputation, u.CreationDate, u.DisplayName, u.LastAccessDate, u.WebsiteUrl, u.Location, u.AboutMe, u.Views, u.UpVotes, u.DownVotes, COUNT(p.Id) AS TotalPosts, AVG(p.Score) AS AveragePostScore, SUM(p.Score) AS TotalVotes, DATEDIFF(DAY, u.CreationDate, GETDATE()) AS AccountAge FROM users u LEFT JOIN posts p ON u.id = p.OwnerUserId GROUP BY u.Reputation, u.CreationDate, u.DisplayName, u.LastAccessDate, u.WebsiteUrl, u.Location, u.AboutMe, u.Views, u.UpVotes, u.DownVotes, u.id ORDER BY NEWID(); -- Randomly orders the rows