Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Confluence & SQL: How to find largest native documents by character count?

Seb Kouba July 7, 2015

I got this far but it seems I get two entries if the two biggest documents are simply versions of the same doc:

SELECT content.title, character_length(body) as characters, contenttype
FROM bodycontent, content
WHERE bodycontent.contentid = content.contentid
ORDER BY characters desc
LIMIT 30;

How can I just get the latest version for each page? (I'm using postgresql)

Thanks

1 answer

1 vote
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 8, 2015

In the CONTENT table filter for CONTENT_STATUS = 'current'.

Seb Kouba July 8, 2015

Unfortunately that doesn't seem to remove the duplicate entries... SELECT content.title, character_length(body) as characters, contenttype FROM bodycontent, content WHERE bodycontent.contentid = content.contentid AND content.content_status='current' ORDER BY characters desc LIMIT 30;

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events