Hi Marius and thanks, Your SQL request returns the same error "invalid use of group function" in my mysql version ... BTW I could have it work by explicitly naming the sum, and using it in the order by : select xws_name, sum(xws_page_views) as pageviewcount from xwikistatsdoc where xws_action='view' and xws_name like '%.%' group by xws_name order by pageviewscount desc I believe it's a difference in behaviour between MySQL 1.4 and 1.5 ... Do you want me to create a JIRA issue for this ? Best Regards, Jeremie -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Marius Dumitru Florea Sent: lundi 18 février 2008 15:19 To: [email protected] Subject: Re: [xwiki-users] MySQL Error "invalid use of group function" in Statistics application Hi Jeremie, Sorry for the inconvenience. Your tables' description seems fine. I attached the description of my tables so you can check it for yourself. I think it all resumes to the following SQL query: select xws_name, sum(xws_page_views) from xwikistatsdoc where xws_action='view' and xws_name like '%.%' group by xws_name order by sum(xws_page_views) desc This query is very similar to the one used for retrieving the Most Viewed Pages. It works fine under: mysql Ver 14.12 Distrib 5.0.45, for pc-linux-gnu (x86_64) using readline 5.2 It would be great if you could run this query and tell me if it works in your case. Best Regards, Marius.