Reputation: 21
id | tithe | offertory | pledge | Total |
---|---|---|---|---|
1 | 120 | 230 | 280 | ??? |
I have a table like this and I want the total = tithe + offertory + pledge. how do I write a query for this?
Upvotes: 0
Views: 41
Reputation: 1729
With the use of sum:
Record.where(id: 1).sum('tithe + offertory + pledge')
Upvotes: 1