Q&A for users, experts, and developers of the Tezos blockchain project
-- Stackoverflow Users Count Distribution in World By Country -- Created by Mehrdad Dowlatabadi (stackoverflow.com/users/9714791/mehrdad-dowlatabadi) SELECT ROW_NUMBER() OVER(ORDER BY count(*) DESC) Rank, UPPER(TRIM( IIF(CHARINDEX(',', Reverse(Location))> 0, Reverse(SUBSTRING(Reverse(Location),1,CHARINDEX(',', Reverse(Location))-1)), Location))) as Country, count(*) as UsersCount, cast(round(CAST((100*count(*)) AS float) / CAST((select count(*) FROM Users Where Reputation>##MinReputation##) AS float),2) as numeric(36,2)) as UsersPercent FROM Users Where Reputation>##MinReputation## Group By UPPER(TRIM( IIF(CHARINDEX(',', Reverse(Location))> 0, Reverse(SUBSTRING(Reverse(Location),1,CHARINDEX(',', Reverse(Location))-1)), Location))) Having count(*)>=##MinCountryUsers## Order By count(*) DESC