Top Users by Country and tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Created by samliew (http://stackoverflow.com/users/584192/samuel-liew)

Music Fans

Q&A for music historians, critics, and fans

-- Top Users by Country and tag
-- Created by samliew (http://stackoverflow.com/users/584192/samuel-liew)

SELECT
    ROW_NUMBER() OVER(ORDER BY Reputation DESC) AS [#], 
    u.Id AS [User Link],
    u.CreationDate,
    u.Reputation,
    u.EmailHash,
    COUNT(p.id) AS [Tagged Posts]
FROM
    Users u
    INNER JOIN Posts p on p.ownerUserid = u.Id
    INNER JOIN PostTags pt on pt.PostId = p.Id
    INNER JOIN Tags t on t.Id = pt.TagId
WHERE
    LOWER(u.Location) LIKE LOWER('%##locationname##%')
  
GROUP BY u.Reputation, u.Id, u.CreationDate, u.EmailHash, t.Tagname

Enter Parameters

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