Hello,
1/ on this article, you shall fix the BLOGposts count : count(CONTENTID) as "number of blogpost" instead of the copy/paste number of pages.. the order clause must be "order by 1 desc;"
2/ I am using Confluence 5.9.2 the table ATTACHMENTS does not exist but it is used in your query (refered as PRE 5.7).. You shall add the validity of your SQL order to the version compliant of COnfluence... 5.9.2 is not.
3/ how to find PRE 5.7 result for Confluence version 5.9.2.
Thanks