Re: using sum with average with mySQL

2011-03-10 Thread Torrent Girl
also, shouldn't those 2 tables be joined together some how? They are...not sure why the first post didn't include all of the query cffunction name=getAverageTotalCalls access=public cfargument name=employeeID type=numeric required=yes cfargument name=dateWorked

Re: using sum with average with mySQL

2011-03-10 Thread Torrent Girl
Shouldn't it be? SELECT avg(da.connects+ sum(ad.acd)) as averageTotalCalls I changed it and still got the same error: Invalid use of group function ~| Order the Adobe Coldfusion Anthology now!

Re: using sum with average with mySQL

2011-03-10 Thread Greg Morphis
can you provide a couple rows of data with no functions? just the ad.acd and the da.connects? and what you would like for it to show? whenever you use an aggregate function like avg you have to use group by like select studentId, avg(grade) from grades group by studentId On Thu, Mar 10, 2011

Re: using sum with average with mySQL

2011-03-10 Thread Torrent Girl
can you provide a couple rows of data with no functions? just the ad.acd and the da.connects? and what you would like for it to show? whenever you use an aggregate function like avg you have to use group by like select studentId, avg(grade) from grades group by studentId On Thu, Mar 10, 2011

Re: using sum with average with mySQL

2011-03-10 Thread Torrent Girl
can you provide a couple rows of data with no functions? just the ad.acd and the da.connects? and what you would like for it to show? whenever you use an aggregate function like avg you have to use group by like select studentId, avg(grade) from grades group by studentId Yes sorry I misread

Re: using sum with average with mySQL

2011-03-10 Thread Greg Morphis
So you want : (13 + 192) / 2? Or do you need 192/13 ? On Thu, Mar 10, 2011 at 2:07 PM, Torrent Girl moniqueb...@gmail.com wrote: can you provide a couple rows of data with no functions? just the ad.acd and the da.connects? and what you would like for it to show? whenever you use an

Re: using sum with average with mySQL

2011-03-10 Thread Greg Morphis
select avg(connects + acd) from ( SELECT da.connects as connects, sum(ad.acd) as acd FROM dialeragent da, agentDaily ad WHERE da.employeeID = ? AND da.employeeID = ad.employeeID AND da.dateWorked = ? AND ad.dateWorked = ? group by connects ) On Thu, Mar 10, 2011 at 2:20 PM, Greg Morphis

using sum with average with mySQL

2011-03-09 Thread Torrent Girl
Hi All I have the following function that I am TRYING to get the average of a sum of 2 added values. cffunction name=getAverageTotalCalls access=public cfargument name=employeeIDtype=numeric required=yes cfargument name=dateWorkedtype=string required=yes

RE: using sum with average with mySQL

2011-03-09 Thread Andrew Scott
Shouldn't it be? SELECT avg(da.connects+ sum(ad.acd)) as averageTotalCalls Regards, Andrew Scott http://www.andyscott.id.au/ -Original Message- From: Torrent Girl [mailto:moniqueb...@gmail.com] Sent: Thursday, 10 March 2011 1:00 PM To: cf-talk Subject: using sum with average

Re: using sum with average with mySQL

2011-03-09 Thread Greg Morphis
also, shouldn't those 2 tables be joined together some how? On Wed, Mar 9, 2011 at 8:00 PM, Torrent Girl moniqueb...@gmail.com wrote: Hi All I have the following function that I am TRYING to get the average of a sum of 2 added values. cffunction name=getAverageTotalCalls access=public