title: What is the advantage of common table expression in sql server
body: <p>we write CTE sql like below one</p>
  
  <pre><code>WITH yourCTE AS 
  (
   SELECT .... FROM :... WHERE.....
  ) SELECT * FROM yourCTE
  </code></pre>
  
  <p>what would be advantage to put sql in with block. i think that if we put complicated sql in with block then we just can write sql like <code>SELECT * FROM yourCTE</code>. as if i am accessing view.
  what is added advantage of using CTE in terms of performance. please discuss. thanks</p>