I currently have a function:
Score::whereIn('site_id', $sites)
->where('type', 1)
->avg('score');
But at the moment, as you can see, it averages out amongst all results within the Scores table. I want to only average out against the most recent row of each $site_id
(the table may not have all $site_id's in the results though).
The table has a created_at
column, which will determine which is the latest one by date/time.
Thank you for your help.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire