Generalist badge

23

Please login or register to vote for this query.

(click on this box to dismiss)

Displays all 40 top tags and your score in each tag. You need to get at least 15 points in 20 tags

Motor Vehicle Maintenance and Repair

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

-- Generalist badge
-- Displays all 40 top tags and your score in each tag. You need to get at least 15 points in 20 tags

declare @UserId int = ##UserId##;

select row_number() over (order by upvotes desc, Count desc),tagName, Count, upvotes from 
   (select top 40 * from Tags Order by Count desc) t
left join 
   (select pt.TagId, count(distinct v.id) upvotes from posts a 
   join posts p on p.Id = a.ParentId
   join postTags pt on pt.PostId = p.Id
   join votes v on v.voteTypeId=2 and v.postId=a.Id
   where a.OwnerUserId=@UserId
   group by pt.TagId) v
on t.Id=v.TagId
order by 1

Enter Parameters

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