Tag wikis + excerpts edited by a given user

1

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

-- List all tags edited by the given user

select
  UserId as [User Link],
  TagName,
  case PostTypeId
    when 4 then 'Excerpt'
    when 5 then 'Tag Wiki'
  end as [Edit Type],
  case PostHistoryTypeId
    when 2 then 'Created'
    when 5 then 'Edited'
  end as [Activity Type]
  
from
  PostHistory
    inner join Posts on Posts.Id = PostId
    inner join Tags  on
      Tags.ExcerptPostId = PostId or
      Tags.WikiPostId    = PostId

where PostHistoryTypeId in (2, 5) -- 2: Created, 5: Edited
  and PostTypeId in (4, 5)        -- 4: Excerpt, 5: Wiki
  and UserId = ##User:int##
  
order by
  LastActivityDate
  desc
  
-- List total tag wiki numbers edited, along with percentage

declare @totaltags float
select  @totaltags = Count(*) from Tags

select
  UserId as [User Link],
  case PostTypeId
    when 4 then 'Excerpt'
    when 5 then 'Tag Wiki'
  end as [Edit Type],
  Count(distinct PostId) as Edits,
  Round(100 * Count(distinct PostId) / @totaltags, 2) as Percentage

from
  PostHistory
    inner join Posts on Posts.Id = PostId
    
where PostHistoryTypeId in (2, 5)
  and PostTypeId in (4, 5)
  and UserId = ##User:int##
  
group by
  UserId, PostTypeId

Enter Parameters

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