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 '%argentina%' THEN 'Argentina'
    WHEN LOWER(Location) LIKE '%armenia%' THEN 'Armenia'
    WHEN LOWER(Location) LIKE '%australia%' THEN 'Australia'
    WHEN LOWER(Location) LIKE '%austria%' THEN 'Austria'
    WHEN LOWER(Location) LIKE '%bangladesh%' THEN 'Bangladesh'
    WHEN LOWER(Location) LIKE '%belarus%' THEN 'Belarus'
    WHEN LOWER(Location) LIKE '%belgium%' THEN 'Belgium'
    WHEN LOWER(Location) LIKE '%brazil%' THEN 'Brazil'
    END) as country,
    COUNT(u.Id) AS number
FROM
    Users AS u
    INNER JOIN Posts AS p ON p.OwnerUserId = u.id
    INNER JOIN PostTags AS pt ON pt.PostId = p.ParentId
    INNER JOIN Tags AS t ON t.id = pt.TagId
WHERE 
    t.TagName LIKE '%[Rr]uby%'
    AND
    u.Reputation >= 1000
GROUP BY (CASE WHEN LOWER(Location) LIKE '%argentina%' THEN 'Argentina'
    WHEN LOWER(Location) LIKE '%armenia%' THEN 'Armenia'
    WHEN LOWER(Location) LIKE '%australia%' THEN 'Australia'
    WHEN LOWER(Location) LIKE '%austria%' THEN 'Austria'
    WHEN LOWER(Location) LIKE '%bangladesh%' THEN 'Bangladesh'
    WHEN LOWER(Location) LIKE '%belarus%' THEN 'Belarus'
    WHEN LOWER(Location) LIKE '%belgium%' THEN 'Belgium'
    WHEN LOWER(Location) LIKE '%brazil%' THEN 'Brazil'
    END)
ORDER BY number DESC

Enter Parameters

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