How to build SQL query in Laravel 5 using join and whereNotIn in controller?

I need to create the following request in Laravel Controller. Request:

select * from table2 where id not in (select from table2 inner join table1 on =


I did this:

$cond = DB::table('table2')
->whereNotIn('id', function($query){
     ->from('table2 inner join table1 on =');


Please help me.

Thank you in advance


source to share

1 answer

$cond = DB::table('table2')->whereNotIn('id', function($sq) { 
       ->join('table1', '', '=', ''); 




All Articles