I've a table with a datetime (format: 'Y-m-d H:i:s') 'created' field and 'amount' (integer) field in each row. Now I want to find out month wise total 'amount' in last year. How can I do this?
EDIT
I made an edit to clarify the actual problem. so basically I want to know total 'amount' in each month, but only for the last year.
EDIT2
Last year means last 365 days. So somewhere I've to consider 'current day'?
EDIT3
My bad, actually last year is last 12 months. So number of days would be between 336 and 365.