You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hello together,
I search a SELECT to get a list of all labels in a specific space (by SPACE-ID) on the database.
I have already tried a few things here, but nothing gave the right result.
Yes I know, it gives a macro with options, that I got all labels from a specific space. But I think the macro gives to much results.
Can anyone help me?
I tried a bit and think got a good statement:
Select cl.labelid, l.name, s.spacekey, count(l.name) as count from content_label cl
join label l on l.labelid = cl.labelid
join content c on c.contentid = cl.contentid
join spaces s on s.spaceid = c.spaceid
where c.CONTENT_STATUS != 'deleted' and c.contenttype != 'SPACEDESCRIPTION' and s.spacekey = 'SPACEKEY' group by cl.labelid, s.spacekey, l.name
order by count desc;
This makes a list of all labels of a space. But not "Spacedescriptions" and not deleted pages.
Hope this is a good hint for you.
Regards, Dominic
I tried your SQL and it's almost perfect.
I added the following phrase on the where clause, because the SQL returned additional all favourites from each users from the pages in the space.
and l.name != 'favourite
So the SQL is now this one:
Select cl.labelid, l.name, s.spacekey, count(l.name) as count from content_label cl
join label l on l.labelid = cl.labelid
join content c on c.contentid = cl.contentid
join spaces s on s.spaceid = c.spaceid
where c.CONTENT_STATUS != 'deleted' and c.contenttype != 'SPACEDESCRIPTION' and s.spacekey = 'SPACEKEY' and l.name != 'favourite' group by cl.labelid, s.spacekey, l.name
order by count desc;
Thanks a lot of your help.
Kind regards,
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond. A long time favorite, Team Cale...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.