lundi 28 octobre 2019

Join Within Join and Count of Records SQL in Laravel

I've gotten stumped by this SQL query for my Laravel project, so first I'll describe the relationships.

cartages has the following fields: id, date_ending

cartage_batches has the following: id, cartage_id

cartage_items has the following: id,batch_id,amount

What I would like to be able to do is query the cartage table to be grouped into year and month pulled from the date_weekending field. But also grab the count of cartage_items in the cartage_batches in each months cartages.

I know it would involve a join within a join but I'm not entirely certain how to accomplish that best from within Laravel.

I'd appreciate any and all help. Thank you!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Nm2RBX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire