March 15th, 2004, 02:28 PM
hello i got a prob.
im making an automated system for a league called a planetary.
i got a database with a table named APplanets and in that table u have a colum named owner and one named tonnage.
now the tonnage colum has diff numbers in it (i.e. 3000).
the owner colum has diff unit names in it to specefy the owner of the planet.
now what i wonna do is add up all the tons for each planet belonging to a certain unit.
like this(but in cfm)
name owner tonnage
planetx - JF - 3000
planetx - JF - 2000
planetx - JF - 5000
planetx - JF - 4000
total tonnage 14000
March 15th, 2004, 05:04 PM
That should be done in the SQL statement. Use the SUM() aggregate function. The database should do as much data manipulation and number crunching as possible; that is its entire purpose.
That said, you could do this in CF by looping over the query and calculating the total.