0

I want to get a column like (datetime % 3600) / 60 as minute,But I use

$collection->columns('(datetime%3600)/60 as minute')

But I got SQL is `main_table`.`datetime%3600/60` AS `minute`

How I fixed It?

2
  • Welcome to SE, could you add more info on the qst. It's not clear enough. Commented Nov 21, 2016 at 4:11
  • Please give some more detail about your issue and also put your detail code. Commented Nov 21, 2016 at 5:55

1 Answer 1

1

Use Zend_Db_Expr for expressions instead of column names:

columns(new Zend_Db_Expr('(datetime%3600)/60 as minute'))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.