title: How to nest a CTE (Common Table Expression)
body: <p>I have the below query</p>
  
  <pre><code>With max_cm1 as (select * from tableA)
  Select * ,
   CASE WHEN TO_CHAR(CCP2.END_DATE,'MM/DD/YYYY') &lt;&gt; '09/09/9000' THEN 'CLOSED'
    WHEN MAX_CM1.MAX_ROLE_CM IS NOT NULL AND HIST.PCMUID IS NOT NULL     THEN 'ASSIGNED'
  ELSE 'UNASSIGNED'
  END STATUS
  from max_cm1
  </code></pre>
  
  <p>Now I need to filter on the case statement. How can I do this?</p>