Forum: Ruby on Rails Complex query

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8c2651465c0fa8d0a6d418cc50026c99?d=identicon&s=25 Random Qu (random-query)
on 2009-04-17 09:45
Hi,
Part of my Invoice table looks like this:

create_table "invoices", :force => true do |t|
  t.datetime "sent_at",
  t.datetime "received_payment_at",
  t.integer  "total_fee"
  ...
end


I want to put together view with monthly sums for 'invoiced amounts' and
'received amounts' like this:

month  |  total invoiced  | total received
Feb 08  | 20,000              | 15,000
Mar 08  | 35,000              | 30,000

What' the best way to write a query & a view to achieve this?

Thanks!
RQ
This topic is locked and can not be replied to.