我在Laravel中有以下多个联接查询
$UserRequests = UserRequests::join('destinations', 'destinations.id', '=', 'destination_id')->leftJoin('request_process', function($join){
$join->whereRaw('request_id in (SELECT request_id FROM request_process GROUP by request_id having max(ticket_status)!=2)');
}
)
->select('process_id','destination_id', 'user_requests.id','name','location','plan_id', 'visit_date','quantity','ticket_status')
->get();
如果存在以下情况,它会用ticket_status=null
产生结果:
ticket_status!=2
我想要什么:
ticket_status==2