All pastes #336944 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-02 11:53 UTC
rendered paste body
this is a table named churn

 sales_reg | no_of_mon |  sum
-----------+-----------+-------
 1006      |         1 |   646
 1006      |         2 |   575
 1006      |         3 |   517
 1006      |         4 |   494
 1006      |         5 |   463
 1007      |         1 |   896
 1007      |         2 |   852
 1007      |         3 |   793
 1007      |         4 |   751
 1007      |         5 |   697
 1008      |         1 |   762
 1008      |         2 |   720
 1008      |         3 |   693
 1008      |         4 |   665
 1008      |         5 |   611
 2222      |         1 |  5193
 2222      |         2 |  4945
 2222      |         3 |  4593
 2222      |         4 |  4316
 2222      |         5 |  4125
 4444      |         1 |  4184
 4444      |         2 |  4027
 4444      |         3 |  3862
 4444      |         4 |  3735
 4444      |         5 |  3644

in this table i need add column called "value" and the data for the value is column "sum" 0f region for month 2 - month 1
ie
for 1006
value = (646-575) 71

pls help me