title: How to reuse a sub query in sql?
body: <p>I have query like the following</p>
  
  <pre><code>select columns
  from (select columns1
        from result_set
        where condition_common and condition1) as subset1
        join
        (select columns2
         from result_set
         where condition_common and condition2) as subset2 
        on subset1.somekey = subset2.somekey
  </code></pre>
  
  <p>I want to somehow reuse </p>
  
  <pre><code>select columns
  from result_set
  where condition_common
  </code></pre>
  
  <p>I have oversimplified the above query, but the above select in reality is huge and complicated. I dont want to have the burden of making sure both are in sync</p>
  
  <p>I dont have any means of programmatically reusing it. T-SQL is ruled out. I can only write simple queries. This is an app limitation.</p>
  
  <p>Is there a way to reuse same subquery, in a single statement</p>