title: Using calculated fields over and over again with a new table
body: <p>I'm fairly new to SQL and i had to do some calculations using a table.Imagine we have a table with fields : ID - Name - Val1 - Val2 ; Lets say i want to add up 2 values and add it to my query result.I can do that easily with a sub query such as:</p>
  
  <pre><code>select val1+val2 as valtotal,* from my table.
  </code></pre>
  
  <p>Now if i want to do some more process on valtotal, i use a derived table such as;</p>
  
  <pre><code>select valtotal*3 as ValMoreCalculated,* from
  (select val1+val2 as valtotal,* from my table) AS A
  </code></pre>
  
  <p>A bit more code maybe??</p>
  
  <pre><code>select ValMoreCalculated/valtotal as ValEvenMoreCalc ,* from 
  (select valtotal*3 as ValMoreCalculated,* from
      (select val1+val2 as valtotal,* from my table) AS A)AS B
  </code></pre>
  
  <p>So if i want to do more calculations with the ValMoreCalculated do i have to go through another derived table? Name it as B for example? Is there an easier way to achieve this in SQL?</p>
  
  <p>PS:the title is a bit off i know,but couldn't figure out what to name it :P</p>