7 messages in com.mysql.lists.win32RE: Why is this illegal?
FromSent OnAttachments
Jeremy Schreckhise21 Oct 2004 06:11 
Danny Willis21 Oct 2004 15:10 
John Bonnett, R&D Australia21 Oct 2004 16:52 
Randy Clamons21 Oct 2004 17:06 
John Bonnett, R&D Australia21 Oct 2004 17:17 
Danny Willis21 Oct 2004 23:00 
Markus Grossrieder22 Oct 2004 08:19 
Subject:RE: Why is this illegal?
From:Randy Clamons (ran@novaspace.com)
Date:10/21/2004 05:06:44 PM
List:com.mysql.lists.win32

Danny,

You can do (probably) this with a single query:

, SUM(pen.penIncident) AS sumPenIncident, , SUM(((res.resLaps * t.trkNumTurns) / sumPenIncident )) AS CPI

I've had sucess with this kind of query in the past.

------------Original Message------------ From: "John Bonnett, R&D Australia" <jbon@sola.com.au> To: "Danny Willis" <dann@project-wildfire.com>, win@lists.mysql.com Date: Thu, Oct-21-2004 4:51 PM Subject: RE: Why is this illegal?

I think the problem is you cannot have an aggregate inside an aggregate. You will need to calcualte SUM(pen.penIncident) in an initial query and process the results of that query in another one to compute the outer sum.

John Bonnett

-----Original Message----- From: Danny Willis [mailto:dann@project-wildfire.com] Sent: Friday, 22 October 2004 7:41 AM To: win@lists.mysql.com Subject: Why is this illegal?

Why is this statement illegal?

, SUM(((res.resLaps * t.trkNumTurns) / SUM(pen.penIncident))) AS CPI

Assumming I am using a GROUP BY.