Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

get distinct attributes? 
 
wownew
Jr. Member
 
Total Posts:  2
Joined:  2007-11-26
 

my product have many attributes,but i want to get one attribute’s value’s distinct:

for example:
i have 2 attributes, one is attr1, another is attr2
and i have some product, their attr1’s vaule like below:
product name | ........ | attr1 | attr2 |
--------------------------------------------------------------
p1 | ..........| at1v1 | atv1 |
p2 | ..........| at1v2 | atv3 |
p3 | ..........| at1v1 | atv2 |
p4 | ..........| at1v2 | atv2 |
.........

so if i want get the distinct attr1’s value, their condition is attr2’s value is atv2
so in fact we should get the value is at1v1 adn at1v2.
if their are in the same table,we can do that like this:
select distinct(attr1) from tablep where attr2 = ‘atv2’;
but in the magento , how to do that?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top