当进行join操作的时候Zend_Db_Table_Select会报一个异常"Select query cannot join with another table"

是因为Zend_Db_Table_Select会检查Select的表是不是来自于已定义的当前表,所以当进行Join操作的时候因为引入了其它表,所以会报错。

解决方法是把_integrityCheck设成false

$select = $this->select()->setIntegrityCheck(false);

这样再进行后续的join操作

$select = $select->from(.....)->joinLeft(.....)->where(.....)....

例如

$select = $this->select();

$select = $this->select()->setIntegrityCheck(false);

$select

->from('setting_force', '*')

->join('users', 'setting_force.ForceUser=users.Email');

相关文章:

  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2021-11-23
  • 2021-09-17
  • 2022-12-23
猜你喜欢
  • 2021-08-02
  • 2021-06-04
  • 2021-08-10
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案