I have there mysql table:
**product (id,name)**
1 Samsung
2 Toshiba
3 Sony
**attribute (id,name,parentid)**
1 Size 0
2 19" 1
3 17" 1
4 15" 1
5 Color 0
6 White 5
7 Black 5
8 Price 0
9 <$100 8
10 $100-$300 8
11 >$300 8
**attribute2product (id,productid,attributeid)**
1 1 2
2 1 6
3 2 2
4 2 7
5 3 3
6 3 7
7 1 9
8 2 9
9 3 10
And listed them like:
**Size**
-- 19" (2)
-- 17" (1)
-- 15" (0)
**Color**
-- White (1)
-- Black (2)
**Price**
-- <$100 (1)
-- $100-$300 (1)
-- >$300 (1)
Please help me the mysql query to list the attribute name and count the number product that this attribute have. EG: When select Size 19" (attribute.id 2)
**Size**
-- 19"
**Color**
-- White (1)
-- Black (1)
**Price**
-- <$100 (1)
-- $100-$300 (1)
This will query to attribute2product >> select the productid >> next query to select other attribute of that productid and display the attribute name, number of prod that attribute name now have... (Like Magento)
Thanks,