title: Getting a count from a nested query with a case statement
body: <p>I am trying to write an SQL statement in which I want to group all the data from a row into either one of two groups and then get a count on those and depending on which group it falls under.</p>
  
  <pre><code>SELECT vehicle "type", count(*) "count"
  FROM(
        SELECT
          CASE
            WHEN auto_type LIKE 'chevy' THEN 'domestic'
            WHEN auto_type LIKE 'ford'  THEN 'domestic'
            ELSE 'foreign'
           END as "vehicle"
         FROM table_name
       )
   GROUP BY vehicle 
  </code></pre>
  
  <p>My end goal it to have it display a table with the two types as type and a count of each.  The nested statement works by itself as does the one where I am just getting the count.  It's when I put the two together is when I get the issue.  It gives me an ORA-00904: "vehicle": invalid identifier  Error.</p>