samedi 25 mai 2019

Filter one record in table with Request ID

I have tabele request_process as follows:

requestID Status
1            0
1            1
1            2
2            0
2            1

I want to get one row per request with maximum status but only those rows whose status for request is not 2

I want to apply this on where clause of query

$UserRequests = UserRequests::leftJoin('request_process', function($join){
$join->on('user_requests.id', '=', 'request_id')->where('status', '!=',2);})
->select('*')   
->get();



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2HBqViE
via IFTTT

Aucun commentaire:

Enregistrer un commentaire