List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:May 16 2006 6:07pm
Subject:Re: Baffled by error
View as plain text  
Mike Blezien wrote:
> Hello,
>
> MySQL 4.1.12
>
> 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
WHERE doesn't understand aggregation. Move the condition 
SUM(c.agent_product_time) >= 500 to a HAVING clause.

pb


>
> ERROR: #1111 - Invalid use of group function
> Any help appreciated...
>
> Mike(mickalo)Blezien
> ===============================
> Thunder Rain Internet Publishing
> Providing Internet Solution that Work
> http://www.thunder-rain.com
> ===============================
>


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/340 - Release Date: 5/15/2006

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