Level 74
I'm sorry but who the hell built that database model? There are so many issues with it that you need to compensate for rather than being able to utilize the things that Laravel gives you for free.
I suggest you give this one a read.
Summer Sale! All accounts are 50% off this week.
Hello, my join with tbl_statusReceptie has multiple rows with same tbl_statusReceptie.idFluxReceptie and i want to select the highest tbl_statusReceptie.statusZona value from the tbl_statusReceptie, how can i group them to get unique tbl_receptieProduse.idReceptie but with the highest value from statusReceptie.
$produse = ProduseReceptie::where('tbl_receptieProduse.idFluxReceptie', '=', $idFlux)
->join('tbl_produse', 'tbl_produse.idProdusErp', '=', 'tbl_receptieProduse.idProdus')
->join('tbl_statusReceptie', 'tbl_statusReceptie.idFluxReceptie', '=', 'tbl_receptieProduse.idFluxReceptie')
->orderBy('tbl_statusReceptie.statusZona', 'DESC')
->select(
'tbl_receptieProduse.idReceptie',
'tbl_receptieProduse.idFluxReceptie',
'tbl_produse.numeProdusErp',
'tbl_produse.codProdusErp',
'tbl_produse.sn',
'tbl_receptieProduse.dataExpirare',
'tbl_receptieProduse.lot',
'tbl_receptieProduse.cantitate',
'tbl_statusReceptie.statusZona'
)
->get();
Please or to participate in this conversation.