title: How to add the result of two different queries?
body: <p>I am making a query using the union method, I would like to add one of my fields that have the same segment but with different costs.</p>
  
  <p>Example:</p>
  
  <pre><code>Select Segment, costs From tableA
  union all
  Select Segment, costs From tableb
  </code></pre>
  
  <p>Result</p>
  
  <pre><code>Segment | costs
  ---------------
  Seg 1   | 1000
  seg 2   | 2000
  Seg 3   | 3000
  Seg 1   | -200
  Seg 3   | -300
  </code></pre>
  
  <p>The result I want:</p>
  
  <pre><code>Segment | costs
  ---------------
  Seg 1   |  800
  seg 2   | 2000
  Seg 3   | 2700
  </code></pre>
  
  <p>I am currently using a query with many join methods, but I would like to have an idea of ​​how to solve this problem with the "union all"</p>