在 joinLeft 中使用<运算符Zend_Db_Table会给出“参数编号无效”错误


Using < operator in joinLeft Zend_Db_Table gives 'Invalid parameter number' error


我一直在尝试选择Zend_Db_Table中为特定用户发送/接收的最新消息。我的查询在 MySQL 中工作正常,但是当我尝试使用 joinLeft 执行此操作时,它给出了一个错误.

查询代码(Zend_Db_Table):

$select=$this->select()
->setIntegrityCheck(false)
->from(array('m1'=>'messages'))
->joinLeft(array('m2'=>'messages'), 'm1.from_id=m2.from_id AND m1.date_created < m2.date_created')
->where('m2.date_created IS NULL')
->where('m1.from_id=? OR m1.to_id=?', $to)
->order('m1.date_created DESC');

问题出在 joinLeft() 中的附加条件中。如果我用"="替换"<",我不会得到任何错误,但这不是达到目的的原因。任何帮助将不胜感激。

put code " ...和 m1.date_created <m2.date_created"在新行中,像这样>

$select=$this->select()
->setIntegrityCheck(false)
->from(array('m1'=>'messages'))
->joinLeft(array('m2'=>'messages'), 'm1.from_id=m2.from_id')
->where('m1.date_created < m2.date_created')
->where('m2.date_created IS NULL')
->where('m1.from_id=? OR m1.to_id=?', $to)
->order('m1.date_created DESC');