Update with join using Zend-framework

て烟熏妆下的殇ゞ 提交于 2021-01-27 21:27:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!