title: How to avoid repeating code in common table expressions in MySQL?
body: <p>I have a query that looks like this:</p>
  <pre><code>WITH 
  cte1 AS
     (SELECT DISTINCT id FROM (&lt;Query1&gt;) t1) ,
  cte2 AS
     (&lt;Query1&gt;)
  SELECT COUNT(DISTINCT cte2.id)
    FROM cte1
      LEFT JOIN cte2 ON &lt;various conditions&gt;
  </code></pre>
  <p>Is there any way to avoid repeating <code>&lt;Query1&gt;</code> in both common table expressions ?</p>