title: Referring to CTE in WHERE condition of UPDATE
body: <p>I'm trying to run a query like this:</p>
  
  <pre><code>WITH cte AS
  (
    SELECT id, category, SUM(amount) AS sum_amount FROM t1 GROUP BY id, category
  )
  UPDATE table SET amount = cte.sum_amount WHERE id = cte.id;
  </code></pre>
  
  <p>However, I keep getting the error </p>
  
  <pre><code>Unknown column 'cte.id in WHERE clause'
  </code></pre>
  
  <p>Does anyone know how I can refer to my common table expression in the UPDATE query, or otherwise, rewrite it?</p>