4

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

sanders
  • 10,794
  • 27
  • 85
  • 127

1 Answers1

3

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.

j0k
  • 22,600
  • 28
  • 79
  • 90
Vadyus
  • 1,299
  • 8
  • 19
  • But then it become a condition and i don't want it to be a condition. I just want to select that field in a different format. – sanders Dec 01 '10 at 14:55
  • ->from give's the select object table name to select from, you should you ->select(array('date'=>new Zend_Db_Expr('FROM_UNIXTIME(expiration)') to pass fields you wanna select – Vadyus Dec 01 '10 at 14:57