Skip to main content
Inspiring
Feb 26, 2019 5:49 PM UTC
Answered

Adding values in a recordset

Hi,

I have a recordset with some values in it that I want to add together but I don't know how to do it.  The recordset looks like:

<cfquery name="rsResults" datasource="username" username="value" password="F00tBall">

SELECT *

FROM options

WHERE value_id = '#FORM.value_id#'

</cfquery>

I list the values in a table

<cfoutput query="rsResults">

#rsResults.value#,

</cfoutput>

and I want to add together all the values and display the result but I don't know how to do that.  Can anyone help with this?


Thanks,Mike

    This topic is closed to new replies. Start a new post to keep the conversation going.
    wycksCorrect answer
    Inspiring
    Feb 26, 2019 6:08 PM UTC

    I found the answer myself.  I used

    <cfset total = ArraySum(rsResults['value'])>

    1 reply

    wycksAuthorCorrect answer
    Inspiring
    Feb 26, 2019 6:08 PM UTC

    I found the answer myself.  I used

    <cfset total = ArraySum(rsResults['value'])>

    Translate