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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -