Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Seb Kouba
Contributor
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
Contributor
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
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events