gpt4 book ai didi

mysql - mysql查询时出现 'pov.products_options_id'错误中的未知列 'having clause'

转载 作者:行者123 更新时间:2023-11-29 20:59:27 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com