title: Using subquery in Doctrine 1.2
body: <p>I'm having alot of trouble using a subquery in an update statement in doctrine 1.2
  I want to set a field to the result of a subquery, but it seems impossible.
  This is what i tried sofar.</p>
  
  <pre><code>$query = Doctrine_Query::create()-&gt;from('Users_Model_Book b');    
  $subSelect = $query-&gt;createSubquery()-&gt;select('ROUND(SUM(br.rating) / COUNT(br.id))')-&gt;from('b.BookRating')-&gt;where('b.BookRating.book_id = b.id');
  $query-&gt;update()-&gt;set('bookrating', '('.$subSelect-&gt;getDql().')')-&gt;where('b.id = ?', $this-&gt;id)-&gt;getRawSql();
  </code></pre>
  
  <p><strong>Will give 'Unknown component alias br'</strong></p>
  
  <pre><code>    $q = new Doctrine_RawSql();
      $q  -&gt;addComponent('b', 'Users_Model_Book')
          -&gt;addComponent('br', 'Users_Model_BookRating')
          -&gt;update('b')
          -&gt;set('b.bookrating', 'ROUND(SUM(br.rating) / COUNT(br.id)')
          -&gt;where('b.id = ' . (bool) $this-&gt;id);
      echo $q-&gt;getSqlQuery();
  </code></pre>
  
  <p>Will return <strong>SELECT b.id AS b_<em>id, br.id AS br</em>_id FROM b WHERE b.id = 1</strong></p>
  
  <p>Anybody that can help me?</p>