title: Calculating column when an ALIAS is involved
body: <p>Question:</p>
  
  <blockquote>
    <p>Write a SELECT statement that returns these column names and data from the Products table: </p>
    
    <p>ProductName - The ProductName column </p>
    
    <p>ListPrice - The ListPrice column </p>
    
    <p>DiscountPercent - The DiscountPercent column </p>
    
    <p>DiscountAmount - A column that’s calculated from the previous two columns </p>
    
    <p>DiscountPrice - A column that’s calculated from the previous three columns </p>
    
    <p>Sort the result set by DiscountPrice in descending sequence. </p>
  </blockquote>
  
  <p>I have gotten to the first calculation, calculating the DiscountAmount. Now, I have to calculate the DiscountPrice by subtracting ListPrice - DiscountPercent - DiscountAmount (which is an alias).</p>
  
  <p>I cannot seem to figure this out. My code so far is below:</p>
  
  <pre><code>SELECT ProductName, 
         ListPrice, 
         DiscountPercent, 
         ListPrice - DiscountPercent AS DiscountAmount
  FROM Products;
  </code></pre>