SQL
AخA
use jawiki_p;
select
month,
sum( edit_count_by_anonymous ),
sum( edit_count_by_registered ),
sum( edit_count_by_bot )
from (
select
month,
case is_registered when 0 then edit_count else 0 end as edit_count_by_anonymous,
case when (is_registered = 1 and is_bot = 0) then edit_count else 0 end as edit_count_by_registered,
case is_bot when 1 then edit_count else 0 end as edit_count_by_bot
from (
select
left(rev_timestamp, 6) as month,
if(rev_user = 0, 0, 1) as is_registered,
if(ifnull(ufg_group, ug_group)="bot", 1,0) as is_bot,
count(*) as edit_count
from revision_userindex
left outer join user_former_groups on rev_user = ufg_user and ufg_group = "bot"
left outer join user_groups on rev_user = ug_user and ug_group = "bot"
group by left(rev_timestamp, 6), if(rev_user = 0, 0, 1), ifnull(ufg_group, ug_group)
) as a
) as b
group by month
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.