title: Using Alias for Created Columns in a math equation - SQL
body: <p>Is it possible in SQL to use the table alias name that was created in another statement? For example:</p>
  <p>TotalPaid was created and now I'd like to use that to get the TotalTax.</p>
  <pre><code>SELECT
      e.FirstName,
      e.LastName,
      e.Salary,
      (Salary/(TIMESTAMPDIFF(MONTH, '2021-01-01', CURDATE()))) AS **TotalPaid**,
      (TotalPaid*TaxRate) AS TotalTax, 
      a.StreetNumber, 
      a.StreetName,
      a.PostalCode,
      a.City, 
      a.Province,
      d.DepartmentName
  FROM 
      EMPLOYEE e
  JOIN 
      ADDRESS a
          ON e.AddressID = a.AddressID
  JOIN
      DEPARTMENT d
          ON e.DepartmentID = d.DepartmentID
  JOIN
      TAX t
          ON a.Province = t.ProvinceName;
         
  </code></pre>
  <p>If I re-write the whole equation for how to get the TotalPaid, it does work.</p>
  <p>*i.e.  ((Salary/(TIMESTAMPDIFF(MONTH, '2021-01-01', CURDATE())))<em>TaxRate) AS TotalTax</em></p>
  <p>But wondering if there is a cleaner way.</p>
  <p>Thank you in advance,</p>