SELECT TOP 1000 u.Reputation, u.CreationDate, u.DisplayNa...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy

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

Enter Parameters

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