World Cup of Reputation

0

Please login or register to vote for this query.

(click on this box to dismiss)

Best average Reputation of Top 100 Users by Country

Drupal Answers

Q&A for Drupal developers and administrators

-- World Cup of Reputation
-- Best average Reputation of Top 100 Users by Country

WITH UsersCountry AS (
  SELECT UserId, 
         Country, 
         RANK() OVER (PARTITION BY Country ORDER BY Reputation DESC) AS Rank, 
         Reputation
  FROM(
    SELECT Reputation,
           Id AS UserId,
          CASE   
                WHEN UPPER(Location) LIKE '%EYGPT%' THEN 'Egypt'
            ELSE 'Unknown'
         END AS Country
      FROM Users
      WHERE Reputation > 1
    ) AS MyTable
),
TopUsersByCountry AS
( 
  SELECT Country, UserId, Reputation
  FROM UsersCountry
)
SELECT *
FROM TopUsersByCountry AS TopUsers

Enter Parameters

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