使用 Zend_Db_Expr

发布于 2024-10-05 14:17:30 字数 605 浏览 0 评论 0原文

我有以下查询:

$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';
}

现在我收到以下错误:

“选择查询无法与另一个查询连接 表”

虽然我不想进行联接。我只想选择该字段作为 unixTimestamp

我怎样才能解决这个问题?

感谢所有帮助

。Tnx

I have the following query:

$select = $this->getDao()->select()
                         ->from(
                           array(new Zend_Db_Expr('FROM_UNIXTIME(expiration)'))
                           );

The getDao function is a reference to my Data Access object class which looks like this:

class Model_Db_AccountresetDao extends Zend_Db_Table_Abstract
{
    protected $_name = 'accountreset';
    protected $_primary = 'reset_id';
}

Now i get this following error:

"Select query cannot join with another
table"

This while i don't want to do a join. I just want to select that field as a unixTimestamp

How can I solve this problem?

All help is appreciated.

Tnx

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

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

发布评论

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

评论(1

メ斷腸人バ 2024-10-12 14:17:30

如果您从 Zend_Db_Table_Abstract 中选择对象,则无法向他传递 ->from()。我认为你应该这样做

$select = $this->getDao()->select()  
                         ->from(this->getDao(),
                           array('_date or some field='.new Zend_Db_Expr('FROM_UNIXTIME(expiration)'))
                           );

或类似的事情。

If you are gettin select object from Zend_Db_Table_Abstract you can't pass him a ->from(). I think you should do like this

$select = $this->getDao()->select()  
                         ->from(this->getDao(),
                           array('_date or some field='.new Zend_Db_Expr('FROM_UNIXTIME(expiration)'))
                           );

or something like this.

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