案子:
表:
product:
product_id|name |
------------------------
1 |iphone 4 |
2 |gallaxy 2 |
3 |blackbery 6 |
product_attribute:
id|product_id|attribute_id
--------------------------------------------------
1 |1 |2
2 |1 |6
. . .
attribute:
------------------------------
attribute_id|name |value|
1 |width |300
2 |width |320
3 |width |310
4 |height|390
5 |height|370
6 |height|380
应该得到结果:
product_id|height|width
1 |380 |320
......................
编辑:
高度和宽度属性只是产品属性的一部分 – 产品需要具有动态能力,由用户在后端添加,就像在magento中一样,因为我选择了eav db design.
如果我们不知道产品有哪些名称,请尽可能写查询.
谢谢