title: ORA-00933 Error on Query of 'With' Table
body: <p>I'm running into an <code>ORA-00933: SQL command not properly ended</code> error. What I am doing is querying on a table I built from a <code>With</code> query. I've been combing through Stack, trying to resolve this issue with every correctly answered question that I could find, but I still run into the error. It's something small and easy to fix I am sure. it's just beyond me at this point. The error occurs on the line with the second select statement:</p>
  
  <pre><code>;WITH sums 
       AS (SELECT a.client_number_id                     AS Client_Number_ID, 
                  Count(Decode(a.sub_type_code, 'A', 1)) AS Applications, 
                  Count(Decode(a.sub_type_code, 'S', 1)) AS License, 
                  Count(Decode(a.sub_type_code, 'L', 1)) AS Lease 
           FROM   mta_spatial.mta_acquired_tenure_svw a 
           WHERE  a.tenure_type_description = 'Coal' 
           GROUP  BY a.client_number_id) 
  SELECT client_number_id, 
         applications, 
         license, 
         lease, 
         applications + license + lease AS 'GrandTotal' 
  FROM   sums; 
  </code></pre>