【问题标题】:Zend Update QueryZend 更新查询
【发布时间】:2015-10-16 09:53:42
【问题描述】:

如何使用zend语法编写下面的mysql查询?

UPDATE core_user_transaction as t 
JOIN core_user_transaction_therapy AS cuts ON cuts.tid=t.tid
JOIN therapy_booking AS tb ON cuts.conf_id = tb.conf_id
JOIN therapy_service_fees AS fees ON cuts.fee_id=fees.id
JOIN therapy_service_taxes AS tst ON fees.service_id=tst.service_id
JOIN core_tax AS ct ON ct.tax_id = tst.tax_id
SET t.tax=ROUND(t.fee*(ct.tax_value/100),2),
    t.amount = (ROUND(t.fee*(ct.tax_value/100),2)+t.fee)
WHERE tb.datetime >= '2015-10-01 00:00:00'
    AND t.state = 'PENDING'
    AND t.status ='ACTIVE'

【问题讨论】:

    标签: php mysql zend-framework sql-update


    【解决方案1】:

    试试这个:

    $adapter = new Zend\Db\Adapter\Adapter($driverConfig);
    $sql = "YOUR_QUERY";
    $statement = $adapter->query($sql);
    $statement->execute();
    

    另请参考Zend\Db\Adapter

    【讨论】:

      【解决方案2】:

      Zend Db 适配器提供的 'update()' 方法是不可能的。 但是,您可以使用适配器手动运行查询。比如:

          // $adapter is an instance of Zend_Db_Adapter
          $adapter->query(YOUR QUERY HERE);
      

      【讨论】:

        猜你喜欢
        • 2013-03-20
        • 1970-01-01
        • 2017-07-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多