title: Update multiple columns in table with SET command
body: <p>I don't necessarily have an error, mainly curious as to what is going on behind the scenes with an <code>UPDATE</code> I am trying to perform on multiple columns of the same table on a single record, using the value of one column and some math to set the value in the other column. Basically a two for one is what I am trying to accomplish.
  I have this row in a table named pipe_tally3:</p>
  
  <pre><code> id |  jt_id   | man_jt_num |  heat  | lt |   manu   | wall_thick | diam | grade | coat_type | coat_thick | loc  | cuts | new_lt | pup | notes |    date    
  ----+----------+------------+--------+----+----------+------------+------+-------+-----------+------------+------+------+--------+-----+-------+------------
    2 | Asset-33 | 1919A      | 39393b | 74 | american |      0.393 |   10 | x44   | stiff     | 12 mils    | yard |    0 |      0 | na  | na    | 2017-03-27
  </code></pre>
  
  <p>I try to <code>UPDATE</code> it like this: </p>
  
  <pre><code>UPDATE pipe_tally3
  SET cuts = 2.0, new_lt = lt - cuts
  WHERE jt_id = 'Asset-33';
  UPDATE 1
  </code></pre>
  
  <p>Then when I check that row again:</p>
  
  <pre><code> id |  jt_id   | man_jt_num |  heat  | lt |   manu   | wall_thick | diam | grade | coat_type | coat_thick | loc  | cuts | new_lt | pup | notes |    date    
  ----+----------+------------+--------+----+----------+------------+------+-------+-----------+------------+------+------+--------+-----+-------+------------
    2 | Asset-33 | 1919A      | 39393b | 74 | american |      0.393 |   10 | x44   | stiff     | 12 mils    | yard |    2 |     74 | na  | na    | 2017-03-27
  </code></pre>
  
  <p>The cuts column did get updated and is now showing the value 2 but the new_lt columns shows the value 74. But it should be (or I want it set to) the value of 72, which would be the value of the lt column 74 subtracted from the cuts column of 2. Why does this not work like this is my main question?
  But if I update the cuts column by itself with</p>
  
  <pre><code>UPDATE pipe_tally3
  SET cuts = 3.0 WHERE jt_id = 'Asset-33';
  UPDATE 1
  </code></pre>
  
  <p>And it does get updated.</p>
  
  <pre><code>id |  jt_id   | man_jt_num |  heat  | lt |   manu   | wall_thick | diam | grade | coat_type | coat_thick | loc  | cuts | new_lt | pup | notes |    date    
  ----+----------+------------+--------+----+----------+------------+------+-------+-----------+------------+------+------+--------+-----+-------+------------
    2 | Asset-33 | 1919A      | 39393b | 74 | american |      0.393 |   10 | x44   | stiff     | 12 mils    | yard |    3 |     72 | na  | na    | 2017-03-27
  </code></pre>
  
  <p>I can then use </p>
  
  <pre><code>UPDATE pipe_tally3
  SET new_lt = lt - cuts WHERE jt_id = 'Asset-33';
  UPDATE 1
  </code></pre>
  
  <p>And it works as desired by using the values from the lt and cuts columns when it sets the new_lt:</p>
  
  <pre><code>id |  jt_id   | man_jt_num |  heat  | lt |   manu   | wall_thick | diam | grade | coat_type | coat_thick | loc  | cuts | new_lt | pup | notes |    date    
  ----+----------+------------+--------+----+----------+------------+------+-------+-----------+------------+------+------+--------+-----+-------+------------
    2 | Asset-33 | 1919A      | 39393b | 74 | american |      0.393 |   10 | x44   | stiff     | 12 mils    | yard |    3 |     71 | na  | na    | 2017-03-27
  </code></pre>
  
  <p>Is there a way I can accomplish this in PostgreSQL? Thanks in advance.</p>
  
  <p>Edit
  I realize I can always do this by hard coding the value in as well:</p>
  
  <pre><code>UPDATE pipe_tally3
  SET cuts = 3.5, new_lt = lt - 3.5 
  WHERE jt_id = 'Asset-33';
  UPDATE 1
  </code></pre>
  
  <p>And that works</p>
  
  <pre><code>id |  jt_id   | man_jt_num |  heat  | lt |   manu   | wall_thick | diam | grade | coat_type | coat_thick | loc  | cuts | new_lt | pup | notes |    date    
  ----+----------+------------+--------+----+----------+------------+------+-------+-----------+------------+------+------+--------+-----+-------+------------
    2 | Asset-33 | 1919A      | 39393b | 74 | american |      0.393 |   10 | x44   | stiff     | 12 mils    | yard |  3.5 |   70.5 | na  | na    | 2017-03-27
  </code></pre>
  
  <p>Just wanted to know why it does not work (or I am not doing something correctly) the other way as specified above.</p>