title: How to use multiple WITH statements in one PostgreSQL query?
body: <p>I would like to "declare" what are effectively multiple TEMP tables using the WITH statement. 
  The query I am trying to execute is along the lines of:</p>
  
  <pre><code>WITH table_1 AS (
  SELECT GENERATE_SERIES('2012-06-29', '2012-07-03', '1 day'::INTERVAL) AS date
  )
  
  WITH table_2 AS (
  SELECT GENERATE_SERIES('2012-06-30', '2012-07-13', '1 day'::INTERVAL) AS date
  )
  
  SELECT * FROM table_1
  WHERE date IN table_2
  </code></pre>
  
  <p>I've read <a href="https://www.postgresql.org/docs/9.5/static/functions-srf.html" rel="noreferrer">PostgreSQL documentation</a> and researched into using multiple <code>WITH</code> statements and was unable to find an answer. </p>