i want to add all sum of values of reg_data3
table of column rainfall
to average_mas_curve
table column year of last year and all of values in past data of previous years as a summation but i want to represent as a function of last day of year please give me it.......help me. e.g y-12-31
.
INSERT INTO mas_aver_curve (year, cumulative)
SELECT '2013-12-31', ROUND(SUM(rainfall), 1) rainfall
FROM reg_data3 G
WHERE date >= '2008-01-01' AND date < '2013-12-31'
You could try:
INSERT INTO mas_aver_curve (year, cumulative)
SELECT STR_TO_DATE(CONCAT(year(NOW())-1,'-12-31'),'%Y-%m-%d') AS LastDay,
ROUND(SUM(rainfall), 1) rainfall
FROM reg_data3 G
WHERE date >= '2008-01-01' AND date < '2013-12-31'
GROUP BY 1;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments