I have a donations table as follows.
Donations Table
| id| amount | member_id |
|---|--------|-----------|
| 0 | 500 | 01|
| 1 | 1000 | 02|
| 2 | 2000 | 01|
How to find sum and group the table by member id as follows.
| amount | member_id |
|--------|-----------|
| 2500 | 01|
| 1000 | 02|
I tried to use the following code but it doesnt seem to work.
const salesValue = await DONATIONS.sum('amount', {
group: 'member_id'
});