title: To calculate sum() two alias named columns - in sql
body: <p>To calculate sum() of two temp column names declared in query  - in SQL</p>
  
  <p><code>stud</code> table has only two columns <code>m1,m2</code>. total and total1 is given as temp name.</p>
  
  <pre><code>select 
     m1, m2, 
     SUM(m1) + SUM(m2) as Total,
     SUM(m1) + SUM(m2) as Total1 
  from 
     stud 
  group by 
     m1, m2
  </code></pre>
  
  <p>How to calculate <code>grandtotal</code> as <code>sum(total)+sum(total1)</code> with the column name declared as temp name for the query to execute.</p>
  
  <p>With cte dosn't support duplicate column names?</p>
  
  <p>How to make use of it to support duplicate columnname</p>