select top 1000 u.id as [User Link] , sum(p.score) [Total...

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 top 1000 u.id as [User Link]
     , sum(p.score) [Total]
     , sum(case when p.posttypeid = 1 then p.score else null end) [Total Q]
     , sum(case when p.posttypeid = 2 then p.score else null end) [Total A]
     , count(*) [# posts]
from users u
inner join posts p on p.owneruserid = u.id
inner join posts q on q.id = nullif(p.parentid, p.id)
inner join posttags pt on pt.postid = q.id
inner join tags t on t.id = pt.tagid
where u.location like concat('%', ##country:string?United States##, '%')
and t.tagname = ##tag:string?javascript##
group by u.id
order by sum(p.score) desc

Enter Parameters

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