How to use multiple sub-query left join in rails -


i having 4 table need join 4 table in rails model how can it

my join sample schema is

select * ( select id,name table1 )a left join ( select * table2 )b on a.id=b.user_id left join ( select * table3 )c on a.id=b.ord_id left join ( select * table4 )d on a.id=d.other_id 

one of best features of rails don't have worry writing these types of database setups. think served going through intro activerecord:

http://guides.rubyonrails.org/active_record_basics.html

activerecord abstracts sql 1 layer, you're (in theory) not writing database-specific code. allows conceptualize database schema @ higher level, rather doing left join, inner join, etc. see here more info on various associations:

http://guides.rubyonrails.org/association_basics.html


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -