Q&A for professional and enthusiast programmers
select userid , 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##