如何在集合中使用表达式。
更具体地说,我想SELECT CAST(qty_shipped AS UNSIGNED)
。
我试过这样的事情:
addExpressionFieldToSelect('qty_shipped','CAST(qty_shipped AS UNSIGNED)',null)
, 但出于某种原因它附加了表名。
谢谢。
最佳答案
尝试:
$collection->getSelect()->columns(array('qty_shipped' => new Zend_Db_Expr ('CAST(qty_shipped AS UNSIGNED)')));
$collection = 集合对象
让我知道这是否适合您。
关于Magento 集合表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9957584/