Pål Bergström | 16 May 20:40

Find the last entry by user_id


How do I find the all records that are the latest from each user, by
user_id? I'm trying to get an :average working but I can't solve it.
This is my find:

Dada.average(:column_with_nr, :conditions => ["created_at > ?",
@date.to_s(:db)], :order => 'created_at', :select => 'DISTINCT user_id')
--

-- 
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@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane