lundi 25 mai 2020

How to Sum last value of all users in database

I have a database with different users, with an amount column....all this user all have different value in their amount colume, but i want to pick all the last amount for each user and sum it.

i tried it like this but game an error

 $returned =  DB::table('sales')->sum('returned')->last();

pls, i dont want the total sum of the amount column....because some users have more than one amount, so i want to pick the last one for each user and sum it



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

Aucun commentaire:

Enregistrer un commentaire