User tests: Successful: Unsuccessful:
Added condition that query that gets modified with COUNT(*) instead of loading all rows must not have any GROUP BY nor HAVING statement (and be of type 'select').
That fixes the bug #31455 : http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31455
Which is a regression of fix #31278 : http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31278