Questions tagged «distinct»

2
Magento ORM等同于“产品的SELECT DISTINCT属性”?
我需要在(伪)SQL中检索用于特定产品属性的所有值的列表: SELECT DISTINCT attribute FROM products; 我将如何使用Magento ORM生成等效查询?我已经试过了该distinct()功能,但是它没有达到我的期望: // Returns an array of NULL with a length equal to all products in the catalog Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('attribute') ->distinct(true) ->getColumnValues('attribute'); 我正在努力获得的将是一组attribute值,没有重复项 array('some value', 'some other value', 'a really common value', 'etc...');
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.