i have a table a_daily having
columns like
1.date
2.FromDate
3.Target
4.Cumulative_Target
I will be adding the rows daily
so every day with reference to fromdate and date the Cumulative_Target column will be updated as shown in the table
This is what i need to do:
date Fromdate Target Cumulative_Target
2012-04-16 2012-04-16 500 500 '(cycle1-started)
2012-04-17 2012-04-16 500 1000
2012-04-18 2012-04-16 800 1800
'
'
'
2012-05-15 2012-04-16 200 xxxxxx '(cycle1-completed)
2012-05-16 2012-05-16 150 150 '(cycle2-started)
2012-05-17 2012-05-16 100 250
2012-05-18 2012-05-16 700 950
'
'
'
'
2012-06-15 2012-06-15 200 xxxxx '(Cycle2-completed)
so the fromdate in the table will be varying per cycle
The query i used for updation is :
UPDATE a_daily
SET a_daily.Cumulative_Generation = sum(a_daily.Target)
between a_daily.Date and a_daily.From_Date
I dont know how to do makeup the computed column Please help me!!
Try this query –
…specify your order clause if needed