select top 50000 * from (select OwnerUserId, sum(CASE WHE...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

select top 50000 *
from
(select OwnerUserId, sum(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) as qCount,
sum(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) as aCount,
COUNT (AcceptedAnswerId) as acceptedPosts, 
SUM(FavoriteCount) as favoritePosts
from Posts
where OwnerUserId in (select distinct OwnerUserId from posts where tags like '%c#%')
group by owneruserid)  as p
join
(select id, views, upvotes, downvotes, age, reputation
from Users
where reputation > 100) as u
on u.id = p.ownerUserId
join
(select userid, sum(CASE WHEN class = 1 THEN 1 ELSE 0 END) as gold,
sum(CASE WHEN class = 2 THEN 1 ELSE 0 END) as silver,
sum(CASE WHEN class = 3 THEN 1 ELSE 0 END) as bronze
from badges
group by userId) as b
on b.userid = u.id

Enter Parameters

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