List:General Discussion« Previous MessageNext Message »
From:Mike Blezien Date:May 16 2006 6:03pm
Subject:Re: Baffled by error
View as plain text  
Tried that, still same error. If I remove the 'AND
SUM(c.agent_product_time) >= '500'

then it works, but I need this in the query.

Mike
----- Original Message ----- 
From: "Ing. Edwin Cruz" <ecruz@stripped>
To: "'Mike Blezien'" <mickalo@stripped>; "'MySQL List'" 
<mysql@stripped>
Sent: Tuesday, May 16, 2006 12:58 PM
Subject: RE: Baffled by error


Is because in your select you have c.accound_id and in your group by clause
you have a.accound_id

Try this:

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 c.account_id ORDER BY mins



Regards!
-----Mensaje original-----
De: Mike Blezien [mailto:mickalo@stripped]
Enviado el: Martes, 16 de Mayo de 2006 12:30 p.m.
Para: MySQL List
Asunto: Baffled by error


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

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
===============================

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1



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