Q&A for professional and enthusiast programmers
select year(p.creationdate), count(case when pt.id = 2 then 2 end) as 'count of answers', count(distinct u.id) as 'count of users ', count(p.id) as 'count of posts', count(distinct (case when u.location like '%Ru%' then u.id end)) as 'count of users from Ru' ,count(distinct (case when u.location like '%Ru%' then u.id end))*100/count(u.id) '%' from users u join posts p on p.owneruserid = u.id join posttypes pt on pt.id = p.posttypeid where pt.id = 1 group by year(p.creationdate) order by year(p.creationdate) desc