I'm trying to execute a query, similar to the following one, using doctrine dql:
'(SELECT sum(b.amount) FROM Table b WHERE b.client_id = a.id AND b.regular = ? AND b.finished = ?)',
I'm not sure if there's a restriction on this but I remember fighting with this sometime ago. I eventually got it working with:
$q = Doctrine_Manager::getInstance()->getCurrentConnection(); $q->execute("UPDATE table a SET a.amount = (SELECT SUM(b.amount) FROM table b WHERE b.client_id = a.id AND b.regular = 0 AND b.finished = 0)");
See if that does the trick. Note that automatic variable escaping doesn't get executed with this query as it's not DQL.