Stackoverflow Users Distribution By Country

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Top Users by Country
-- Created by Mehrdad Dowlatabadi (stackoverflow.com/users/9714791/mehrdad-dowlatabadi)

SELECT ROW_NUMBER() OVER(ORDER BY  count(*) DESC) Rank,
 TRIM( IIF(CHARINDEX(',', Reverse(Location))> 0, Reverse(SUBSTRING(Reverse(Location),1,CHARINDEX(',', Reverse(Location)))), Location))
,count(*)
FROM
    Users
Where 
    Reputation>10
Group By 
    
    TRIM( IIF(CHARINDEX(',', Reverse(Location))> 0, Reverse(SUBSTRING(Reverse(Location),1,CHARINDEX(',', Reverse(Location)))), Location))
Having 
    count(*)>5
Order By 
    count(*) DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results