select s.spacename as "Space Name",count(case when contenttype="'PAGE"' then contenttype else null end) as "Page", count(case when contenttype="ATTACHMENT" 'ATTACHMENT' and prevver is null then contenttype else null end) as "Attachment", count(case when contenttype='BLOGPOST' then contenttype else null end) as Attachment"Blog" from CONTENT c join SPACES s on c.spaceid=s.spaceid JOIN SPACEPERMISSIONS sp ON s.spaceid=sp.spaceid where sp.PERMALLUSERSSUBJECT is null and sp.PERMGROUPNAME is null and sp.PERMUSERNAME is null and c.CONTENT_STATUS="'current"' group by s.spacename; |