This question already has an answer here:
- MySQL Group by SUM 2 answers
- Laravel Eloquent: sum with groupBy 1 answer
This should be easy, but I can't figure it out. I have a product table which looks like this (very abbreviated for clarity)
[![product_quantity][1]][1]
So all I want to do is to aggragate the quantities for each product id eg product id 128 quantity of 37. All I have come up with is the following, which groups product_name but does not add the quantities correctly. This is Laravel Query builder code. But no matter, raw SQL is fine if you can help. Thank You !
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mHV5VV
via IFTTT
Aucun commentaire:
Enregistrer un commentaire