Re: output column average using coldfusion

2008-04-21 Thread Brian Kotek
Use the AVG aggregate function. I think you really need to take a step back from what you're doing and spend some time learning basic SQL, because a huge number of the issues you've been posting about would be immediately solved if you had an understanding of joins and aggregate functions. There ar

RE: output column average using coldfusion

2008-04-21 Thread Bobby Hartsfield
Select avg(columnname) as whatever from table ..:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com -Original Message- From: erik tom [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 10:01 AM To: CF-Talk Subject: Re: output column average using

Re: output column average using coldfusion

2008-04-21 Thread erik tom
>I have to point out that this approach is terribly inefficient. Calculations >like this should be in at the database level using SQL, that's exactly what >it's supposed to do. Any time you're looping over queries to run more >queries, or to total things up, it should be a big red flag, because in

Re: output column average using coldfusion

2008-04-18 Thread Brian Kotek
I have to point out that this approach is terribly inefficient. Calculations like this should be in at the database level using SQL, that's exactly what it's supposed to do. Any time you're looping over queries to run more queries, or to total things up, it should be a big red flag, because in almo

Re: output column average using coldfusion

2008-04-18 Thread erik tom
>If they're simple numbers and you're feeling lazy, >#arrayAverage(listToArray(valueList(myQuery.myColumn)))# will do the >deed, though I don't know about the efficiency. You can just roll up >a total as you loop through the rows and then divide by row count at >the end. > >cheers, >barneyb > >On

RE: output column average using coldfusion

2008-04-18 Thread Brad Wood
Actually, you don't even need to convert it to a list and back to an array, Just do this: #arrayavg(myQuery['myColumn'])# ~Brad -Original Message- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Friday, April 18, 2008 2:46 PM To: CF-Talk Subject: Re: output colum

Re: output column average using coldfusion

2008-04-18 Thread Barney Boisvert
If they're simple numbers and you're feeling lazy, #arrayAverage(listToArray(valueList(myQuery.myColumn)))# will do the deed, though I don't know about the efficiency. You can just roll up a total as you loop through the rows and then divide by row count at the end. cheers, barneyb On Fri, Apr 1