即使信息表中没有与所选语言相关的行,我也会尝试使此查询包含所有 products_options_name 结果。当我现在运行查询时,只显示 products_propoptions,它在信息表中具有与所选语言相关的行。
非常感谢任何帮助。在此先感谢,巴斯
SELECT PPO.products_options_name, I.information_title, PTL.information_id,
COUNT(PPA.products_attributes_id) as amount,
options_id FROM products_propattributes PPA
INNER JOIN products_propoptions PPO ON PPA.options_id = PPO.products_options_id
LEFT JOIN properties_to_information PTL ON PPA.options_id = PTL.option_id
LEFT JOIN information I ON PTL.information_id = I.information_id
WHERE PPO.language_id = 6 AND I.language_id = 6 AND PPA.products_id = 121
GROUP BY PPA.options_id ORDER BY PPA.products_options_sort_order
表:products_propoptions
- products_options_id
- 语言标识
- products_options_name
- products_options_sort_order
表:products_propattributes
- products_attributes_id
- products_id
- options_id
- options_values_id
- options_values_price
- 价格前缀
- products_options_sort_order
表:信息
- 信息ID
- information_group_id
- 信息标题
- 信息描述
- parent_id
- 排序
- 可见的
- 无索引
- 语言标识
表:properties_to_information
- properties_to_information_id
- option_id
- 信息ID