问题
iam trying to update a table with join using zend on mysql. Below is the query that I want to do through the zend. Already thanks.
UPDATE tbproduto
LEFT JOIN (SELECT codigo as codTipoProduto, cdTipo FROM tbtipoproduto) as tbtipoproduto ON tbproduto.cdTipoProduto = tbtipoproduto.codTipoProduto
LEFT JOIN (SELECT codigo as codTipo, descricao as descTipo FROM tbtipo ) as tbTipo ON tbtipoproduto.cdTipo = tbTipo.codTipo
SET valor = 10.0
WHERE codigo > 0
回答1:
I don't believe this is possible with the 'update()' method provided by the Zend Db Adapter.
You can however, run the query manually using the adapter. Something like:
// $adapter is an instance of Zend_Db_Adapter
$adapter->query(YOUR QUERY HERE);
来源:https://stackoverflow.com/questions/18454689/update-with-join-using-zend-framework