Hey, i''m having 2 tables: TABLE A -------- id name b_id #id from TABLE B ------------------------------ TABLE B -------- id name the problem is i want all the objects form table b where there''s no record for in table a. -- 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 -~----------~----~----~----~------~----~------~--~---
so0ly wrote:> i''m having 2 tables: > TABLE A > -------- > id > name > b_id #id from TABLE B > > ------------------------------ > TABLE B > -------- > id > name > > the problem is i want all the objects form table b where there''s no > record for in table a.B.find( :all, :select => ''b.*'', :joins => ''left join a on b.id = a.b_id'', :conditions => ''a.b_id is null'' ) -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mark Reginald James wrote:> so0ly wrote: > >> id >> name >> >> the problem is i want all the objects form table b where there''s no >> record for in table a. > > B.find( :all, > :select => ''b.*'', > :joins => ''left join a on b.id = a.b_id'', > :conditions => ''a.b_id is null'' ) > > -- > We develop, watch us RoR, in numbers too big to ignore.thnx :) -- 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 -~----------~----~----~----~------~----~------~--~---