1 回答

TA貢獻(xiàn)1863條經(jīng)驗(yàn) 獲得超2個(gè)贊
通過(guò)使用DB::table修復(fù)
$applications = DB::table('applications as a')
->join('operations as o', function($join){
$join->on('o.application_id', '=', 'a.id')
->on('o.id', '=', DB::raw("(SELECT max(id) from operations WHERE operations.application_id = a.id)"));
})
->join('users as u', 'o.user_id', '=', 'u.id')
->join('states as s', 'o.status_id', '=', 's.id')
->select(['a.id as a_id','a.number','o.*', 'u.name as u_name', 'u.surname as u_surname', 's.name as s_name']);
return Datatables::of($applications)->make(true);
- 1 回答
- 0 關(guān)注
- 156 瀏覽
添加回答
舉報(bào)