Среди пользователей из России какой процент задаёт вопросы

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 year(p.creationdate) as ' year ',
--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 pt.id = 1 then u.id end)) as 'count of users from Ru, who asked'
, round(cast (count(distinct (case when pt.id = 1 then u.id end)) as float)*100/count(distinct u.id), 3) 'percent, %'
from users u
left join posts p on p.owneruserid = u.id
left join posttypes pt on pt.id = p.posttypeid
where u.location like '%Ru%'
group by year(p.creationdate)
order by year(p.creationdate) desc

Enter Parameters

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