select top 1000 userid as [User Link] , sum(q) q , sum(a) a

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 userid as [User Link]
      , sum(q) q
      , sum(a) a 
from
(
select owneruserid as userid
     , count(*) q
     , 0 a
from posts
where posttypeid = 1
and owneruserid is not null
group by owneruserid
having count(*) < ##q##
union
select owneruserid as [User Link]
     , 0 
     , count(*) a
from posts
where posttypeid = 2
and owneruserid is not null
group by owneruserid
having count(*) > ##a##
) as data
group by userid
having sum(q) < ##q## and sum(a) > ##a##
order by  sum(a) asc

Enter Parameters

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