Arel: Mathematical arithmic on columns

It’s hard to explain, so I’ll just write down what I have currently:

table.project("sum(`#{}`.`#{table[:column_1].name}` *


I like to sanitize this and leave out as much raw sql as possible, and
have multiple ideas/suggestions which may already exist:

table.project("sum(#{table[:column_1].full_name} *



If it’s aliased, of course

table.project(table[:column_1].times(table[:column_2]).sum) # #sum

already exists, only #times doesn’t.

Which of the above is possible, but in a different way?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs