Getting Distinct Rows While Still Returning Other Fields

On occasion I encounter this problem but I never remember how I fix it
the time before… which is annoying for myself.

I have the following find:
@conversations = Message.find(:all, :select => “DISTINCT from_user_id,
created_at”, :conditions => [“to_user_id = ?”, session[:user_id]])

I want distinct from_user_id but at the same time I want to have other
fields removed like created_at. If I return more then from _user_id I
am not getting distinct from_user_ids…

What is the rails way of solving my problem? :slight_smile:

Thanks eveyone for helping me out! :slight_smile:

John K.
[email protected]

http://www.kopanas.com
http://www.cusec.net
http://www.soen.info

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