Hi there, Anyone knows how to use a scope with a table alias condition like: SELECT *> FROM table_name > AS alias_name, alias_name2 > Where alias_name.field = alias_name2.fieldOr if anyone has other suggestion.. Thank you -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/NlZFtC4pm5oJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe this is the sort of thing you''re looking for? http://guides.rubyonrails.org/association_basics.html#self-joins -- Chris http://livingsocial.com | http://clabs.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi there Chris, i already found a solution, but thanks anyway. I need to check from 2 table entries where they have a field in common. Here''s the snippet:> User.from("Users as u1, Users as u2).where("u2.LastName=u1.LastName AND u1.id != u2.id")On 9 Abr, 19:38, Chris Morris <chri...-jPI29ImzmbLYtjvyW6yDsg@public.gmane.org> wrote:> Maybe this is the sort of thing you''re looking for? > > http://guides.rubyonrails.org/association_basics.html#self-joins > > -- > Chrishttp://livingsocial.com|http://clabs.org-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.