Currently I have this SQL which returns all spaces, their labels and how many times that label is used. This is great other than the fact that it also returns personal spaces. How can I tweak this SQL to filter out personal and only return global spaces?
select
spacename as "Space"
, name as "Label"
, count(name) as Count
from CONTENT_LABEL
left join LABEL
on CONTENT_LABEL.labelid = LABEL.labelid
left join CONTENT
I think, this is what you need:
select c.spaceid, s.spacename, l.name, count(l.name) as Count from content_label cl
join CONTENT c on c.contentid = cl.contentid
join label l on l.labelid = cl.labelid
join spaces s on s.spaceid = c.spaceid
where c.CONTENT_STATUS != 'deleted' and c.contenttype != 'SPACEDESCRIPTION' and s.spacetype != 'personal'
group by c.spaceid, s.spacename, l.name
order by count desc
Regards, Dominic
This works create! Thank you @Dominic Lagger
Do you know where I can find a database map or sorts for Confluence? Wondering what reference you use when creating SQL like this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
My reference is the database itself :) I also didn't find some schema or documentation.
I once went through all tables and analyzed their contents :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.