mysql - Laravel 5 database query retrieve first table data but not in other table -


here give mysql sample code. want write code in laravel 5. e.g.

select * employees employees.id not in(select     team_employees.employee_id     team_employees) 

please help. thanks.

hi found bellow answer. pretty cool , easy. commenting....... think bellow code you........

 > db::table('employees')     >          ->select(['employees.id', 'employees.code', 'employees.full_name'])     >          ->wherenotexists(function ($query) use ($request) {     >                 $query->select(['team_employees.employee_id'])     >                       ->from('team_employees')     >                       ->whereraw('team_employees.employee_id = employees.id')     >                       ->where('team_employees.team_id', $request['team_id']);     >                 }); 

$request parameter send client side.....


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -