I was getting the following error:

Invalid use of group function query: SELECT n.nid, n.type, n.title, COUNT(c.cid) AS cmts FROM node n INNER JOIN comments c ON n.nid = c.nid WHERE 1 GROUP BY n.nid, n.type, n.title ORDER BY COUNT(c.cid) DESC LIMIT 10 in /sites/all/modules/report/modules/report_content/report_content.module on line 137.

I solved my error by changing 'ORDER BY COUNT(c.cid)' to 'ORDER BY cmts'.

The same thing needs to be changed on line 87 and line 90 by changing 'ORDER BY COUNT(nid)' to 'ORDER BY post'.

Apparently once a field has been named it should to be refer by that name in other clauses.

Comments

ki’s picture

Status: Active » Fixed

* Fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.