我正在使用以下代码并收到以下错误
$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
有什么我想念的吗?任何帮助都会受到赞赏。
答案 0 :(得分:3)
我认为你在制作连接语句时应该将完整性检查设置为false:
$select->setIntegrityCheck(false);