Support the ongoing development of Laravel.io →
Database Eloquent Laravel.io
Last updated 2 years ago.
0

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 .

0

@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.
0

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.

0

your original post should work. have you tried https://github.com/barryvdh/laravel-debugbar. it's a nice sql profile. you can check the sql query running against your database to see if matches your expectation.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

moschel26 moschel26 Joined 21 Dec 2015

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.