Question asking badges

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

with user_questions as (
  select OwnerUserId, count(*) number_asked, avg(Score) avg_score
  from Posts
  where PostTypeId = 1
        and Score >= ##score?1##
        and OwnerUserId is not null
  group by OwnerUserId
),

asking_badges as (
  select case 
           when number_asked >= ##gold?50## 
           then 1
         end gold,
         case
           when number_asked >= ##silver?10##
           then 1
         end silver,
         case
           when number_asked >= ##bronze?1##  then 1
         end bronze,
         case
           when number_asked is null  then 1
         end none
  from user_questions
       right join Users on OwnerUserId = Id
)

select count(*) users, 
       sum(gold) gold, 
       sum(silver) silver, 
       sum(bronze) bronze, 
       sum(none) none
from asking_badges

Enter Parameters

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