I have a product model in my ruby on rails application which has name,endorsement and expense attributes.
I need to write a query that list all records, but for every record I need to calculate endorsement-expense as income value. That seems to be ok. However, I need to sum all of the incomes consequtively as well.
For example my records are like these:
Name Endorsement Expense X 100 25 Y 20 17 X 60 55 T 178 78
I need to list those values as:
Name Endorsement Expense Income Total Income X 100 25 75 75 Y 20 17 3 78 X 60 55 5 83 T 178 78 100 183
How can I do that ?