I want to retrieve from the database an array of values, one for each month, that is the sum of the users transaction prices.
For example: A user buy three items (1Euro, 2Euro, 3Euro) in March and two items in April(5euro, 10Euro).
I want to return an array containing something like {mar:6,apr:15}
Apologies if the explanation is poor but can someone point me in the right direction?
Thanks,
kSeudo.
You have to group by
purchaseDateand sum up thepurchaseAmounts:If you want the amounts per user and month, include the
userID:If you are looking for the purchases from a single user, add
where UserID = That_Users_IDto the first statement.