;with revs as ( select postid , case when posthistorytype...

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 revs as (
select postid
     , case 
       when posthistorytypeid < 7 then 'Edit'
       when posthistorytypeid > 6 then 'Rollback'
       end as [edittype]
from posthistory ph
inner join posts p on ph.postid = p.id 
where posthistorytypeid in (4,5,6 ,7,8,9)  -- simple edits
and userid = 527764
and p.owneruserid <> 527764
group by revisionguid, postid, case 
       when posthistorytypeid < 7 then 'Edit'
       when posthistorytypeid > 6 then 'Rollback'
       end
)

select [edittype]
     , count(*)
from revs
group by [edittype]
union 
select 'distinct posts'
     , count(*)
     from (select distinct postid from revs) as distposts

Enter Parameters

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