Support the ongoing development of →
Database Eloquent
Last updated 1 year ago.

I'm not well experienced but it should works.

$join->on(DB::raw('a.field3 = c.field3'), DB::raw(''), DB::raw(''));

I think you need to check Eloquent: Relationships .


@saurabhd, it's not working. if the query in debug, the result : LEFT JOIN table3 AS c ON a.field2 = c.field2 AND a.field3= c.field3 = ``

Last updated 7 years ago.

No worries! Let's make it simple:

$join->on('a.field3',  '=', 'c.field3');

I found the similar solution from blog but I don't why the first answer not working.


your original post should work. have you tried it's a nice sql profile. you can check the sql query running against your database to see if matches your expectation.


Sign in to participate in this thread!


Your banner here too?

moschel26 moschel26 Joined 21 Dec 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.