title: How can I use query-of-query UNION on n-recordsets when var scoping is needed?
body: <p>I would like to be able to do a query of a query to UNION an unknown number of recordset. However when doing a query-of-query dots or brackets are not allowed in record set names.</p>
  
  <p>For example this fails:</p>
  
  <pre><code>&lt;cfquery name="allRecs" dbtype="query"&gt;
      SELECT * FROM recordset[1]
      UNION
      SELECT * FROM recordset[2]
  &lt;/cfquery&gt;
  </code></pre>
  
  <p>Using dynamic variable names such as "recordset1" work but this is in a function and needs to be var-scoped so I can't build up the variable names dynamically without producing memory leaks in a persisted object.</p>
  
  <p>Any other ideas?</p>