Top Users by Country

0

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

SELECT 
    (CASE WHEN LOWER(Location) LIKE '%bulgaria%' THEN 'Bulgaria'
    WHEN LOWER(Location) LIKE '%canada%' THEN 'Canada'
    WHEN LOWER(Location) LIKE '%chile%' THEN 'Chile'
    WHEN LOWER(Location) LIKE '%china%' THEN 'China'
    WHEN LOWER(Location) LIKE '%colombia%' THEN 'Colombia'
    WHEN LOWER(Location) LIKE '%costa rica%' THEN 'Costa Rica'
    WHEN LOWER(Location) LIKE '%croatia%' THEN 'Croatia'
    WHEN LOWER(Location) LIKE '%czech%' THEN 'CR'
    WHEN LOWER(Location) LIKE '%denmark%' THEN 'denmark'
    WHEN LOWER(Location) LIKE '%egypt%' THEN 'egypt'
    WHEN LOWER(Location) LIKE '%estonia%' THEN 'estonia'
    WHEN LOWER(Location) LIKE '%finland%' THEN 'finland'
    WHEN LOWER(Location) LIKE '%france%' THEN 'france'
    WHEN LOWER(Location) LIKE '%germany%' THEN 'germany'
    WHEN LOWER(Location) LIKE '%ghana%' THEN 'ghana'
    WHEN LOWER(Location) LIKE '%greece%' THEN 'greece'
    WHEN LOWER(Location) LIKE '%hong kong%' THEN 'hong kong'
    WHEN LOWER(Location) LIKE '%hungary%' THEN 'hungary'
    WHEN LOWER(Location) LIKE '%india%' THEN 'india'
    WHEN LOWER(Location) LIKE '%indonesia%' THEN 'indonesia'
    WHEN LOWER(Location) LIKE '%ireland' THEN 'ireland'
    WHEN LOWER(Location) LIKE '%israel%' THEN 'israel'
    WHEN LOWER(Location) LIKE '%italy%' THEN 'italy'
    WHEN LOWER(Location) LIKE '%japan%' THEN 'japan'
    WHEN LOWER(Location) LIKE '%kenya%' THEN 'kenya'
    WHEN LOWER(Location) LIKE '%latvia%' THEN 'latvia'
    WHEN LOWER(Location) LIKE '%lithuania%' THEN 'lithuania'
    WHEN LOWER(Location) LIKE '%malaysia%' THEN 'malaysia'
    WHEN LOWER(Location) LIKE '%mexico' THEN 'mexico'
    WHEN LOWER(Location) LIKE '%morocco%' THEN 'morocco'
    WHEN LOWER(Location) LIKE '%nepal%' THEN 'nepal'
    WHEN LOWER(Location) LIKE '%netherlands%' THEN 'netherlands'
    WHEN LOWER(Location) LIKE '%romania%' THEN 'romania'
    WHEN LOWER(Location) LIKE '%saudi%' THEN 'saudi'
    WHEN LOWER(Location) LIKE '%serbia%' THEN 'serbia'
    WHEN LOWER(Location) LIKE '%singapore%' THEN 'singapore'
    WHEN LOWER(Location) LIKE '%slovakia' THEN 'slovakia'
    WHEN LOWER(Location) LIKE '%slovenia%' THEN 'slovenia'
    WHEN LOWER(Location) LIKE '%south africa%' THEN 'south africa'
    WHEN LOWER(Location) LIKE '%korea%' THEN 'south korea'
    WHEN LOWER(Location) LIKE '%spain%' THEN 'spain'
    WHEN LOWER(Location) LIKE '%sri lanka%' THEN 'sri lanka'
    WHEN LOWER(Location) LIKE '%sweden%' THEN 'sweden'
    WHEN LOWER(Location) LIKE '%switzerland%' THEN 'switzerland'
    WHEN LOWER(Location) LIKE '%taiwan' THEN 'taiwan'
    WHEN LOWER(Location) LIKE '%thailand%' THEN 'thailand'
    WHEN LOWER(Location) LIKE '%tunisia%' THEN 'tunisia'
    WHEN LOWER(Location) LIKE '%turkey%' THEN 'turkey'
    WHEN LOWER(Location) LIKE '%ukraine%' THEN 'ukraine'
    WHEN LOWER(Location) LIKE '%uae%' THEN 'uae'
    WHEN LOWER(Location) LIKE '%emirates%' THEN 'emirates'
    WHEN LOWER(Location) LIKE '% usa %' THEN 'usa '
    WHEN LOWER(Location) LIKE '%united states' THEN 'united states'
    WHEN LOWER(Location) LIKE '%vietnam%' THEN 'vietnam'
    END) as country, COUNT(Id)
FROM 
    Users
GROUP by (CASE WHEN LOWER(Location) LIKE '%bulgaria%' THEN 'Bulgaria'
    WHEN LOWER(Location) LIKE '%canada%' THEN 'Canada'
    WHEN LOWER(Location) LIKE '%chile%' THEN 'Chile'
    WHEN LOWER(Location) LIKE '%china%' THEN 'China'
    WHEN LOWER(Location) LIKE '%colombia%' THEN 'Colombia'
    WHEN LOWER(Location) LIKE '%costa rica%' THEN 'Costa Rica'
    WHEN LOWER(Location) LIKE '%croatia%' THEN 'Croatia'
    WHEN LOWER(Location) LIKE '%czech%' THEN 'CR'
    WHEN LOWER(Location) LIKE '%denmark%' THEN 'denmark'
    WHEN LOWER(Location) LIKE '%egypt%' THEN 'egypt'
    WHEN LOWER(Location) LIKE '%estonia%' THEN 'estonia'
    WHEN LOWER(Location) LIKE '%finland%' THEN 'finland'
    WHEN LOWER(Location) LIKE '%france%' THEN 'france'
    WHEN LOWER(Location) LIKE '%germany%' THEN 'germany'
    WHEN LOWER(Location) LIKE '%ghana%' THEN 'ghana'
    WHEN LOWER(Location) LIKE '%greece%' THEN 'greece'
    WHEN LOWER(Location) LIKE '%hong kong%' THEN 'hong kong'
    WHEN LOWER(Location) LIKE '%hungary%' THEN 'hungary'
    WHEN LOWER(Location) LIKE '%india%' THEN 'india'
    WHEN LOWER(Location) LIKE '%indonesia%' THEN 'indonesia'
    WHEN LOWER(Location) LIKE '%ireland' THEN 'ireland'
    WHEN LOWER(Location) LIKE '%israel%' THEN 'israel'
    WHEN LOWER(Location) LIKE '%italy%' THEN 'italy'
    WHEN LOWER(Location) LIKE '%japan%' THEN 'japan'
    WHEN LOWER(Location) LIKE '%kenya%' THEN 'kenya'
    WHEN LOWER(Location) LIKE '%latvia%' THEN 'latvia'
    WHEN LOWER(Location) LIKE '%lithuania%' THEN 'lithuania'
    WHEN LOWER(Location) LIKE '%malaysia%' THEN 'malaysia'
    WHEN LOWER(Location) LIKE '%mexico' THEN 'mexico'
    WHEN LOWER(Location) LIKE '%morocco%' THEN 'morocco'
    WHEN LOWER(Location) LIKE '%nepal%' THEN 'nepal'
    WHEN LOWER(Location) LIKE '%netherlands%' THEN 'netherlands'
    WHEN LOWER(Location) LIKE '%romania%' THEN 'romania'
    WHEN LOWER(Location) LIKE '%saudi%' THEN 'saudi'
    WHEN LOWER(Location) LIKE '%serbia%' THEN 'serbia'
    WHEN LOWER(Location) LIKE '%singapore%' THEN 'singapore'
    WHEN LOWER(Location) LIKE '%slovakia' THEN 'slovakia'
    WHEN LOWER(Location) LIKE '%slovenia%' THEN 'slovenia'
    WHEN LOWER(Location) LIKE '%south africa%' THEN 'south africa'
    WHEN LOWER(Location) LIKE '%korea%' THEN 'south korea'
    WHEN LOWER(Location) LIKE '%spain%' THEN 'spain'
    WHEN LOWER(Location) LIKE '%sri lanka%' THEN 'sri lanka'
    WHEN LOWER(Location) LIKE '%sweden%' THEN 'sweden'
    WHEN LOWER(Location) LIKE '%switzerland%' THEN 'switzerland'
    WHEN LOWER(Location) LIKE '%taiwan' THEN 'taiwan'
    WHEN LOWER(Location) LIKE '%thailand%' THEN 'thailand'
    WHEN LOWER(Location) LIKE '%tunisia%' THEN 'tunisia'
    WHEN LOWER(Location) LIKE '%turkey%' THEN 'turkey'
    WHEN LOWER(Location) LIKE '%ukraine%' THEN 'ukraine'
    WHEN LOWER(Location) LIKE '%uae%' THEN 'uae'
    WHEN LOWER(Location) LIKE '%emirates%' THEN 'emirates'
    WHEN LOWER(Location) LIKE '% usa %' THEN 'usa '
    WHEN LOWER(Location) LIKE '%united states' THEN 'united states'
    WHEN LOWER(Location) LIKE '%vietnam%' THEN 'vietnam'
    END)

Enter Parameters

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