Вопросы и ответы о сайте для программистов
declare @userCount bigint; select @userCount = count(1) from Users; select POWER(10, FLOOR(LOG(u.Reputation, 10))) as RepGroup, count(1) as [Count], ROUND(count(1) * 100.0 / @userCount, 10) as [Percentage] from Users u group by POWER(10, FLOOR(LOG(u.Reputation, 10))) order by RepGroup desc;