Top User Of a Peticular Tag in India

3

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

-- Top User Of a Peticular Tag In India
-- List of Top User Of a Tag In India based on Total Upvotes. 

;WITH USER_BY_TAG
AS
(
  SELECT 
    ROW_NUMBER() OVER(ORDER BY COUNT(*) DESC) Rank,
    u.Id AS [User Link], 
    TagName,
    COUNT(*) AS UpVotes
  FROM Tags t
      INNER JOIN PostTags pt ON pt.TagId = t.id
      INNER JOIN Posts     p ON p.ParentId = pt.PostId
      INNER JOIN Votes     v ON v.PostId = p.Id and VoteTypeId = 2
      INNER JOIN Users     u ON u.Id = p.OwnerUserId
  WHERE 
      LOWER(Location) LIKE '%india%'
     AND  TagName = ##tagName:string##
  GROUP BY u.id, TagName
)

SELECT * FROM USER_BY_TAG WHERE rank <= 1000 ORDER BY upvotes DESC ;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached