All pastes #334058 Raw Edit

Something

public text v1 · immutable
#334058 ·published 2007-01-31 10:11 UTC
rendered paste body
this is the description of table churn

  Column   |       Type        | Modifiers
-----------+-------------------+-----------
 cust_cod  | integer           | customer code
 c_type    | character varying | type of contract
 sales_reg | character varying | region of the customer
 pack_cod  | character varying | what package he is using
 inv_date  | date              | his bill date
 bill_amt  | double precision  | amount of his bill
 status    | character varying | whether the customer is active or not
 no_of_mon | integer           | number of month ie starting month to his invoice date
 arpu      | integer           |
 arpu_id   | integer           |
 aon_id    | integer           |
 aon       | integer           |
 revenue   | double precision  | his total(bill_amt)

in this table there are 136281 no of customers in month 1
then it get reduced on month 2 to 117000
then 3 to 100123 etc

now my problem is i need to set the status of customer is active to month 2 when the customer has the bill date in 2 month
this to be done for next sucessive months

pls tell me how to do it?