How many upvotes do I have for each tag?

0

Please login or register to vote for this query.

(click on this box to dismiss)

how long before I get tag badges?

Mythology

Q&A for enthusiasts and scholars of mythology and folklore

-- How many upvotes do I have for each tag?
-- how long before I get tag badges?

DECLARE @UserId int = ##UserId##

--SELECT TOP 40
--    TagName,
--    COUNT(*) AS UpVotes 
--FROM Tags
--    INNER JOIN PostTags ON PostTags.TagId = Tags.id
--    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
    --INNER JOIN Votes ON Votes.PostId = Posts.Id and VoteTypeId = 2
--WHERE 
--    Posts.OwnerUserId = @UserId

--GROUP BY TagName 
--ORDER BY UpVotes DESC

--select * From Posts where Posts.PostTypeId = 1 and 2 IN Posts.Tags

--SELECT TagName, COUNT(*) AS Questions 
--FROM Tags
--INNER JOIN PostTags ON PostTags.TagId = Tags.Id
--INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
--WHERE Posts.PostTypeId = 1
--GROUP BY TagName
--ORDER BY Questions DESC

--declare @VoteStats table (PostId int, up int, down int, CreationDate datetime)
--insert @VoteStats
--select
--    p.Id,
--    up = sum(case when VoteTypeId = 2 then
--        case when p.ParentId is null then 5 else 10 end
--        else 0 end),
--    down = sum(case when VoteTypeId = 3 then 2 else 0 end),
--    p.CreationDate
--from Votes v join posts p on v.postid = p.id
--where v.VoteTypeId in (2,3)
--and OwnerUserId = @UserId
--and p.CommunityOwnedDate is null
--and datediff(day, p.CreationDate, v.CreationDate) > @ignoreDays
--and datediff(day, p.CreationDate, @latestDate) > @minAgeDays
--group by p.Id, p.CreationDate, p.ParentId

declare @topTags table (id int, name nvarchar(35), questionCount int)
insert @topTags
select Id, TagName, Count from Tags

Enter Parameters

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