Hi All,
I have a component with couple methods, each method is the result of query from the database.
I want to do some calculations after i get the data from the server. I am lokking for a solution with good performance because I have many calculations to do.
Code:
<cfset myObj = CreateObject("component", "cfcs.myComponent") />
<cfset firstQry = myObj.getFirstResult(arguments.A, arguments.B) />
<cfset secondQry = myObj.getSecondResult(arguments.A, arguments.B) />
Both query results have the same structure myID, myDesc, year_1, year2, year3
firstQry have 10 rows, how can I sum the years row 3 (myID = 3) and years row 5 (myID = 5) ?
and add the result of the calculation into firstQry as line 11 (new myID = 11).
secondQry have one row result.
How can I multiple the firstQry years row 4 (myID=4) with the secondQry years row 1 (only row myID = 1)?
and add the result into firstQry as line 12 (new myId =12).
I was thinking to use query of query but I wondering if it is a better way to do this.
Thanks in advance for your help.
Best,