title: Creating Tables in Db2 involving a With Clause
body: <p>I'm trying to a table view in DB2 but Its returning an error</p>
  
  <p>My code involves a WITH clause as well so I'm not sure if this is part of it</p>
  
  <p>My Code looks like:</p>
  
  <pre><code>CREATE TABLE DB_NAME.TABLE_NAME_FINAL AS
  WITH Q1 AS ( SELECT * FROM TABLE_NAME WHERE CONDITION = X) SELECT * FROM Q1
  </code></pre>
  
  <p>I have obviously simplified it but there is a need for the with clause</p>
  
  <p>Also, how do I ensure this table is placed in a specific table space?</p>
  
  <p>I also had problems when I tried to do it like:</p>
  
  <pre><code>CREATE TABLE DB_NAME.TABLE_NAME_FINAL (COLUMNNAME INT) IN TABLE_SPACE_NAME;
  INSERT INTO DB_NAME.TABLE_NAME_FINAL
  WITH Q1 AS ( SELECT * FROM TABLE_NAME WHERE CONDITION = X) SELECT COLUMNNAME FROM Q1;
  </code></pre>