List:General Discussion« Previous MessageNext Message »
From:Chris Sansom Date:May 16 2006 5:56pm
Subject:Re: Baffled by error
View as plain text  
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?

-- 
Cheers... Chris
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
Thread
Baffled by errorMike Blezien16 May
  • Re: Baffled by errorRhino16 May
  • Re: Baffled by errorChris Sansom16 May
  • RE: Baffled by errorIng. Edwin Cruz16 May
    • Re: Baffled by errorMike Blezien16 May
  • Re: Baffled by errorMike Blezien16 May
  • Re: Baffled by errorPeter Brawley16 May
  • Re: Baffled by errorRhino16 May
  • Re: Baffled by errorMike Blezien16 May
    • Re: Baffled by errorPeter Brawley16 May
  • Re: Baffled by errorMike Blezien16 May
  • RE: Baffled by errorGordon16 May
    • Re: Baffled by errorMike Blezien16 May