mardi 28 octobre 2014

Merge two query results into one with join condition


Vote count:

0




I have two query as follow



schemes = Scheme.all.where(condition)
.select(:id,:name,:productLabel,:minInvestment,:schemeCategory,:schemeCode)
.limit(10).offset(0)
.includes(:returns)

navs = Nav.all.where("id IN (select MAX(id) from navs group by schemeCode)")


I need to merge "schemes" and "navs" using "schemeCode" which is available in both , I am using RAILS 4 Active record.


Any help will be useful.



asked 1 min ago







Merge two query results into one with join condition

Aucun commentaire:

Enregistrer un commentaire