At 12:29 -0500 16/5/06, Mike Blezien wrote:
>trying to figure out why I keep getting this error with the following query:
>SELECT c.account_id,a.name,a.company,SUM(c.agent_product_time) AS
>mins FROM account a LEFT JOIN calls c ON c.account_id = a.id WHERE
>c.calldate >= DATE_SUB(NOW(),INTERVAL 14 DAY) AND c.agent_id = 9
>AND SUM(c.agent_product_time) >= '500' GROUP BY a.account_id
>ORDER BY mins
>ERROR: #1111 - Invalid use of group function
>Any help appreciated...
Just a wild guess, but... you have 'ON c.account_id = a.id', but
you're grouping by a.account_id. Do both of those definitely exist,
or should you be grouping by a.id?
Highway 57 Web Development -- http://highway57.co.uk/
It isn't pollution that's harming the environment. It's
the impurities in our air and water that are doing it.
-- Al Gore, former US Vice President