title: SQL - Calculating sum of variable updated values
body: <p>I'm new to SQL and I have the following problem.<br />
  I want to sum total number of errors that are reaching my device.</p>
  <p>So, suppose I have inside <code>my_table</code> variables with names <code>SeqErr</code> and <code>TotalSeqErr</code>.<br />
  I initialized them to <code>0</code> and verified it, but when I do the following:</p>
  <pre><code>  UPDATE my_table
    SET
    ...
      SeqErr         =      COALESCE(SeqErr, 0) + 1,
      TotalSeqErr    =      SeqErr,
    ...
  </code></pre>
  <p>I see that when I retrieve this table it is coming with the following values:<br />
  <code>SeqErr = 1</code> , <code>TotalSeqErr = 0</code> (i.e. <code>SeqErr</code> was updated but <code>TotalSeqErr</code> is using old <code>SeqErr</code> value instead of updated one).</p>
  <p>How can I solve this issue?<br />
  <strong>Note: Probably there is issue similar to mine here but I couldn't find one.</strong></p>