php - Doctrine Update query with a sub-query -
i'm trying execute query, similar following one, using doctrine dql:
doctrine_query::create() ->update('table a') ->set('a.amount', '(select sum(b.amount) table b b.client_id = a.id , b.regular = ? , b.finished = ?)', array(false, false)) ->execute();
but rises doctrine_query_exception message: "unknown component alias b"
is restriction using sub-queries inside 'set' clause, can give me help?
thanks in advance.
i'm not sure if there's restriction on remember fighting sometime ago. got working with:
$q = doctrine_manager::getinstance()->getcurrentconnection(); $q->execute("update table set a.amount = (select sum(b.amount) table b b.client_id = a.id , b.regular = 0 , b.finished = 0)");
see if trick. note automatic variable escaping doesn't executed query it's not dql.
Comments
Post a Comment