作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
SELECT DISTINCT p.products_image,
p.products_quantity,
m.manufacturers_id,
p.products_id,
pd.products_name,
p.products_price,
p.products_tax_class_id,
p.products_price_sorter,
p.products_qty_box_status,
p.master_categories_id
FROM products p
LEFT JOIN manufacturers m USING(manufacturers_id)
LEFT JOIN products_description pd ON p.products_id = pd.products_id
JOIN products_to_categories p2c ON p.products_id = p2c.products_id
JOIN categories c ON p2c.categories_id = c.categories_id
LEFT JOIN meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id
AND mtpd.language_id = 2
JOIN products_attributes p2a ON p.products_id = p2a.products_id
JOIN products_options po ON p2a.options_id = po.products_options_id
JOIN products_options_values pov ON p2a.options_values_id = pov.products_options_values_id
WHERE (p.products_status = 1
AND pd.language_id = 2
AND ((pd.products_name LIKE '%t%'
OR p.products_model LIKE '%t%'
OR m.manufacturers_name LIKE '%t%'
OR (mtpd.metatags_keywords LIKE '%t%'
AND mtpd.metatags_keywords !='')
OR (mtpd.metatags_description LIKE '%t%'
AND mtpd.metatags_description !='')
OR pd.products_description LIKE '%t%')))
GROUP BY p.products_id
HAVING sum(pov.products_options_id IN (12, 20)
AND pov.products_options_values_id IN (91,82)) > 0
ORDER BY p.products_sort_order,
pd.products_name;
最佳答案
改变拥有
来自
HAVING sum(pov.products_options_id IN (12, 20)
AND pov.products_options_values_id IN (91,82)) > 0
到
HAVING pov.products_options_id IN (12, 20)
AND pov.products_options_values_id IN (91,82)
为什么使用 > 0 ?您正在使用 IN()
关于mysql - mysql查询时出现 'pov.products_options_id'错误中的未知列 'having clause',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37361803/
我是一名优秀的程序员,十分优秀!