作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试制作一个表格,显示具有各种产品属性的产品列表,但我完全无法做到这一点。
预期表如下所示;
entity_id, sku, price, cost
1, abc, 20, 15
2, def, 30, 25
3, ghi, 10, 5
下面的两个产品属性都存储在表“catalog_product_entity_decimal”的同一列“value”中
Price: attribute_id = 77
Cost: attribute_id = 81
因此,如果我内部连接表,每个entity_id 对于 attribute_id 77 和 81 有 2 行
你能帮我解决这个问题吗?
最佳答案
您可以两次加入属性表
select a.entity_id, a.sku, b.value price, c.value cost
from your_product_table a
inner join your_table_attribute b
on a.entity_id = b.entity_id
AND b.attribute_id = 77
inner join your_table_attribute c on a.entity_id = c.entity_id
AND c.attribute_id = 81
where a.entity_id = 1
关于mysql - 获取多个产品属性作为 "catalog_product_entity"上的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59069416/
我正在尝试制作一个表格,显示具有各种产品属性的产品列表,但我完全无法做到这一点。 预期表如下所示; entity_id, sku, price, cost 1, abc, 20,
我是一名优秀的程序员,十分优秀!