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

    table.project("sum(`#{table.name}`.`#{table[:column_1].name}` *
`#{table.name}`.`#{table[:column_2].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} *
#{table[:column_2].full_name})")
 
table.project("sum(#{table[:column_1].times(table[:column_2]).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?

--
Dykam

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to