我有以下查询:
$select = $this->getDao()->select()
->from(
array(new Zend_Db_Expr('FROM_UNIXTIME(expiration)'))
);
getDao 函数是对我的数据访问对象类的引用,如下所示:
class Model_Db_AccountresetDao extends Zend_Db_Table_Abstract
{
protected $_name = 'accountreset';
protected $_primary = 'reset_id';
}
现在我得到以下错误:
"Select query cannot join with another table"
虽然我不想加入。我只想选择该字段作为 unixTimestamp
我该如何解决这个问题?
感谢所有帮助。
谢谢
最佳答案
如果你正在从 Zend_Db_Table_Abstract 中选择对象,你不能向他传递一个 ->from()
。我认为你应该这样做
$select = $this->getDao()->select()
->from(this->getDao(),
array('_date or some field='.new Zend_Db_Expr('FROM_UNIXTIME(expiration)'))
);
或类似的东西。
关于php - 使用 Zend_Db_Expr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4325548/