Q&A for professional and enthusiast programmers
select count(owneruserid) as 'user count', dy as 'year' from ( select owneruserid, datepart(year,creationdate) dy from posts group by owneruserid, datepart(year,creationdate) having count(case when posttypeid = 1 then 1 end) = 0 and count(case when posttypeid = 2 then 1 end) = 0 ) x group by x.dy