select tagname , count(*) as [Number of posts] , sum(case...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select tagname
     , count(*) as [Number of posts]
     , sum(case when posttypeid = 2 then 1 else 0 end ) as [# Answers]
     , sum(p.score) as [Total Score]
     , sum(case when CommunityOwnedDate is null and p.posttypeid = 2 then p.score else 0 end) as [Non wiki answer score]
     , sum(case when CommunityOwnedDate is not null and p.posttypeid = 2 then p.score else 0 end) as [Wiki answer score]
from posts p
inner join posttags pt on pt.postid = coalesce(p.parentid, p.id)
inner join tags t on t.id = pt.tagid
where p.owneruserid = ##userid:int?22656##
group by tagname

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results