I need like this
AMT COMM DATETIME
100 1 09/01/2010
110 10 09/02/2010
160 50 09/03/2010
170 10 09/04/2010
Running totals works fine with this query:
select (select SUM(isnull(AMT,0)+ISNULL(COMM,0)) from #yourtable t1 where t1.dtColumn <= t2.dtColumn) AMT,COMM,dtColumn
from #yourtable t2
If I run this query again and again I get Larger values in the AMT field, since its update with another set.
If COMM is not changed then NO UPDATE.
IF COMM is changed then UPDATE to have running totals.
I need to check whether COMM column is changed or not, if not then I need Updated statement.But Finally it should be Running Total.