I need help to write a small number of mysql query statements to access one database table, get the sum of some values for each user, then place that total in another table.
## Deliverables
I have a two database tables.
1 database table is called:
#_points_total
It has the following fields:
user_id, point
I have another table called:
#_points_monthly_total
It has the following fields:
user_id, jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, year_total, average_activity_points_per_month
I need to have the correct mysql query statement to collect all of the points totals for "point" for "user_id" for each month in table
#_points_total.
A small cron script would be needed to place these query statements to update the #_points_monthly_total table each month.
The field "year_total" is the sum of all fields 'jan','feb','mar'.... etc
The field "average_activity_points_per_month" must calculate the 'average' of points based on a monthly average calculated using the 12 month period.