Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Italian language
-- Enter Query Title -- Enter Query Description DECLARE @UserId INT SELECT @UserId = 213474 DECLARE @TotalCount BIGINT SELECT @TotalCount = COUNT(*) FROM Users SELECT @TotalCount SELECT u.Id, u.DisplayName, u.Reputation, (SELECT COUNT(*) FROM Users u2 WHERE u2.Reputation >= u.Reputation) AS Rank, (SELECT COUNT(*) FROM Users u2 WHERE u2.Reputation >= u.Reputation) / @TotalCount AS Percentile FROM Users u WHERE u.Id = @UserId