Make sure COUNT is not called with ORDER BY