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
Post a Comment