Число пользователей, написавших более 2^n сообщений и вопросов

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

select min(Posts) as [Min Posts], null as [Min Questions], count(OwnerUserId) as Users
from
  (
  select count(*) as Posts, OwnerUserId
  from Posts
  group by OwnerUserId
  ) pu
group by floor(log(Posts) / log(2))
--order by 1

union

select null as [Min Posts], min(Questions) as [Min Questions], count(OwnerUserId) as Users
from
  (
  select count(*) as Questions, OwnerUserId
  from Posts
  where PostTypeId = 1
  group by OwnerUserId
  ) qu
group by floor(log(Questions) / log(2))
--order by 1

order by 1, 2

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results