Wu Junchen
2008-Jul-24 15:13 UTC
model.sum(:col,:group=>''col1,col2'') only return 2 columns?
There are 3 columns in my model ''Bank'':bank_name,money,save_year,and I want to get the sum money group by bank_name and save_year. However,Bank.sum(:money,:group=>''bank_name,save_year'') just returns the sum money and the save_year column,and Bank.sum(:money,:group=>''save_year,bank_name'') just returns the sum money and the bank_name column!How can I get all of the three columns?And it''s a rails feature or bug?My db is mysql,and the sql of rails 2.1 generated returns all of the three columns in mysql query browser. Any help will be appreciated! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---