My Recent Tag History

1

Please login or register to vote for this query.

(click on this box to dismiss)

Show my vote history for a specific tag. VoteTypeFilter is optional, but the UI forces you to at least throw a space in there. The filter is a case insensitive filter on the VoteType column so you can enter 'up', 'accepted' or 'bounty' for example to filter those. For a full list of vote types see http://data.stackexchange.com/stackoverflow/query/73707/list-of-all-votetypes.

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

declare @UserId int = ##UserId##;
declare @TagName varchar(25) = ##TagName:string##;
declare @VoteTypeFilter varchar(50) = ##VoteTypeFilter:string##;

-- Map tag data that exists on question posts onto answer post rows.
with PostQuestionMappings as (
  select p.Id,
    p.ParentId,
    IsNull(p.ParentId, p.Id) as QuestionId,
    p.Score,
    IsNull(p.Tags, q.Tags) as Tags,
    p.CommunityOwnedDate
  from Posts p
  left outer join Posts q on (q.id = p.ParentId)
  where p.OwnerUserId = @UserId
)

select top 2000
  convert(varchar(10), v.CreationDate, 111) as VoteDate,
  v.PostId as [Post Link],
  vt.Name as VoteType,
  count(*) as Amount,
  v.BountyAmount,
  p.Tags,
  p.CommunityOwnedDate
from PostQuestionMappings p
join PostTags pt on (p.QuestionId = pt.PostId)
join Tags t on (pt.TagId = t.Id)
join Votes v on (p.Id = v.PostId)
join VoteTypes vt on (v.VoteTypeId = vt.Id)
where t.TagName = @TagName
  and (rtrim(@VoteTypeFilter) = ''
  or lower(vt.Name) like '%' + lower(@VoteTypeFilter) + '%')
group by v.CreationDate, v.PostId, vt.Name, v.BountyAmount, p.Tags, p.CommunityOwnedDate, vt.Id
order by v.CreationDate desc, vt.Id

Enter Parameters

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