-1

Hi i need to get all the product attributes and the count of products against each attribute option on my custom page. Filtering magento confection on the basis of attribute is taking so long . So i need direct sql query to achieve this.

Please provide me some reference or code.

Rohit Goel
  • 3,396
  • 8
  • 56
  • 107

1 Answers1

0

You can use GROUP BY and COUNT(*) to count the number of products against each attribute.

SELECT ATTRIBUTE, COUNT(*)
FROM YOUR_TABLE
GROUP BY ATTRIBUTE;

More: mysql count group by having

Community
  • 1
  • 1
Yash Verma
  • 64
  • 1
  • 7