I have a table with fields name
, type
and amount
, for example
|--------------|--------|---------|
| name | type | amount |
|--------------|--------|---------|
| Name 1 | 1 | 100 |
|--------------|--------|---------|
| Name 1 | 2 | 200 |
|--------------|--------|---------|
| Name 1 | 1 | 300 |
|--------------|--------|---------|
| Name 2 | 1 | 100 |
|--------------|--------|---------|
And I want to group records by name so that get sum of amount on equal name and type, for example
|--------------|--------|---------|
| name | type | amount |
|--------------|--------|---------|
| Name 1 | 1 | 400 |
|--------------|--------|---------|
| Name 1 | 2 | 200 |
|--------------|--------|---------|
| Name 2 | 1 | 100 |
|--------------|--------|---------|
How can I do this with Laravel? Thank's in advance!
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2GI2ygX
via IFTTT
Aucun commentaire:
Enregistrer un commentaire