title: how to use trigger in mysql to update a column's value from particular date to till date only for a unique customer id
body: <p>I'm Working on A <strong>c# form Application</strong> with <strong>mysql Database</strong>.</p>
  
  <p>below Is design of ,table i'm using to save my data for 
  customer with following columns..</p>
  
  <p>id : auto-increment id for identify each row and getting balance for customer with max id of cid </p>
  
  <p>cid : customer's ID </p>
  
  <p>billno  : invoice number 
  deposit : the amount being deposit against that bill 
  billtotal : the total amount of bill...</p>
  
  <p><strong>balance :  previous balance + current billtotal - current billdeposit</strong></p>
  
  <p>I'm calculating balance with my form application 
  and everything works fine </p>
  
  <p>Now the problem is with deleting a bill or updating a bill</p>
  
  <p><strong>suppose in bill no. 9  i have entered 100 instead of 1000</strong>
  Now i wants to change that value </p>
  
  <p>**</p>
  
  <blockquote>
    <p>if I'll change that then  all my calculations of balance column  from
    that row to last row will be  wrong.</p>
  </blockquote>
  
  <p>** </p>
  
  <p>what will best way to Do So....</p>
  
  <p>i'm thinking of a trigger after update for this but i don't know how 
  to create a trigger to perform these calculation only for current row to last row and only for that customers cid </p>
  
  <p><img src="https://i.stack.imgur.com/rSaWT.png" alt="Image of my Table design"></p>