title: Save value from sub query and reuse it later?
body: <p>How do I use the result of a sub query multiple times? Is there any way to name that result and use it somewhere else? I know about with xyz as ... and that doesn't seem to work?</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/766657/how-do-you-use-variables-in-a-simple-postgresql-script">this</a> and would like something more specific?</p>
  
  <p>Sample of broken code:</p>
  
  <pre><code>with g_surf as (select surface_area from countries where name like 'Germa%')
  select abs(surface_area - g_surf) from countries;
  </code></pre>
  
  <p>working code that uses the entire sub query:</p>
  
  <pre><code>select abs(surface_area - (select surface_area from
      countries where name like 'Germa%')) from countries;
  </code></pre>