Given any user- how to find out for which all tags he/she is the top user?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Hinduism

Q&A for followers of the Hindu religion and those interested in learning more about Hinduism

-- Top Users by tag
-- Answer to the question: https://hinduism.meta.stackexchange.com/q/1184/647
-- Created By TheLittleNaruto

SELECT
    ROW_NUMBER() OVER(ORDER BY Reputation DESC) AS [#], 
    u.Id AS [User Link], 
    u.Reputation,
    t.tagname,
    count(p.id)
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
    u.id='##id##'
group by u.reputation, u.id, t.tagname
ORDER BY
    Reputation DESC;

Enter Parameters

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