gpt4 book ai didi

mysql - 查询不再适用于 MySQL 5

转载 作者:搜寻专家 更新时间:2023-10-30 23:15:51 24 4
gpt4 key购买 nike

SELECT xp.productid, xp.product, xc.classid, xiW.date, xco.optionid, xco.option_name, xiW.id, xiW.image_path, xiW.path_on_server
FROM xcart_products xp
INNER JOIN xcart_variants xv ON xp.productid = xv.productid
INNER JOIN xcart_variant_items xvi ON xv.variantid = xvi.variantid
INNER JOIN xcart_class_options xco ON xvi.optionid = xco.optionid
INNER JOIN xcart_classes xc ON xco.classid = xc.classid AND xc.class = 'COLOR'
LEFT JOIN xcart_images_W xiW ON xiW.id = xvi.variantid
GROUP BY xco.optionid
ORDER by xp.product ASC

我收到错误信息:xp.productid 不在 GROUP BY 中

然后我添加它并得到 xp.product isn't in GROUP BY

我添加它并得到 xc.classid 不在 GROUP BY 中

我添加它并一直向下 -

SELECT xp.productid, xp.product, xc.classid, xiW.date, xco.optionid, xco.option_name, xiW.id, xiW.image_path, xiW.path_on_server
FROM xcart_products xp
INNER JOIN xcart_variants xv ON xp.productid = xv.productid
INNER JOIN xcart_variant_items xvi ON xv.variantid = xvi.variantid
INNER JOIN xcart_class_options xco ON xvi.optionid = xco.optionid
INNER JOIN xcart_classes xc ON xco.classid = xc.classid AND xc.class = 'COLOR'
LEFT JOIN xcart_images_W xiW ON xiW.id = xvi.variantid
GROUP BY xco.optionid, xp.productid, xp.product, xc.classid, xiW.date, xco.option_name, xiW.id, xiW.image_path, xiW.path_on_server
ORDER by xp.product ASC

这不可能是正确的吧?它确实可以运行,但我想 GROUP BY 在 MySQL 5 中的处理方式与 4 中的处理方式略有不同,或者我的查询可能在 4 中几乎不起作用?

最佳答案

显然你已经启用了ONLY_FULL_GROUP_BY模式

只需禁用它,您就可以再次对 GROUP_BY

这个很棒的 mysql 扩展感到满意

关于mysql - 查询不再适用于 MySQL 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13886090/

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