Count number of questions, answers and comments on a tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

https://meta.stackoverflow.com/q/316413

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

select u.DisplayName
,sum( case when posttypeid = 1 then 1 else null end) as Questions 
,sum( case when posttypeid = 2 then 1 else null end)  as Answers
,sum( case when posttypeid  in (1,2) then 1 else null end) as Total
,sum(sum( case when posttypeid = 1 then 1 else null end)) over () as TotalQuestions
,sum(sum( case when posttypeid = 2 then 1 else null end) ) over () as TotalAnswers

from posts p
inner join posttags pt on pt.postid = coalesce(p.parentid, p.id)
inner join tags t on t.id = pt.tagid
inner join Users u on p.OwnerUserId = u.Id
where t.TagName = 'deep-learning'and

( lower(u.Location) like '%saudi%' or
lower(u.Location) like '%saudi arabia%' )
group by u.DisplayName

Enter Parameters

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