Thread: coding delema

    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2004
    Rep Power

    Exclamation coding delema

    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

    get it????
  2. #2
  3. No Profile Picture

    Join Date
    Jun 2002
    Raleigh, NC
    Rep Power
    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.

IMN logo majestic logo threadwatch logo seochat tools logo