Zend_Db_Select 加入帮助

发布于 2024-11-04 19:56:03 字数 669 浏览 4 评论 0原文

我正在使用以下代码并收到以下错误

$select = $model->select();
$select->from(array('stocktakejob'), 
            array("ProductID" => "stocktakejob.ProductID",
                    "TotalCount" => "SUM(stocktakejob.NewCount)"
              )
       )->join(array('products'),
               'products.ProductID = stocktakejob.ProductID', 
               array("ProductCode" => "products.ProductCode")
       )->where("stocktakejob.StockTakeID = ".$stocktake->getStockTakeID())
       ->group('stocktakejob.ProductID');

错误:异常

Select query cannot join with another table

我缺少什么吗?任何帮助将不胜感激。

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

$select = $model->select();
$select->from(array('stocktakejob'), 
            array("ProductID" => "stocktakejob.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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

破晓 2024-11-11 19:56:03

我认为在创建 join 语句时应该将完整性检查设置为 false:

$select->setIntegrityCheck(false);

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

$select->setIntegrityCheck(false);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文