开发者

Zend_Db_Select help with join

开发者 https://www.devze.com 2023-03-02 15:00 出处:网络
i\'m using the following code and get the following error $select = $model->select(); $select->from(array(\'stocktakejob\'),

i'm using the following code and get the following error

$select = $model->select();
$select->from(array('stocktakejob'), 
            array("ProductID" => "stocktakejo开发者_开发知识库b.ProductID",
                    "TotalCount" => "SUM(stocktakejob.NewCount)"
              )
       )->join(array('products'),
               'products.ProductID = stocktakejob.ProductID', 
               array("ProductCode" => "products.ProductCode")
       )->where("stocktakejob.StockTakeID = ".$stocktake->getStockTakeID())
       ->group('stocktakejob.ProductID');

error: Exception

Select query cannot join with another table

Is there something i'm missing ? anyhelp would be appreciated.


I think that you should set integrity check to false when making join statements:

$select->setIntegrityCheck(false);
0

精彩评论

暂无评论...
验证码 换一张
取 消