Question

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

I get errors stating: xp.productid isn't in GROUP BY

Then I add that and get xp.product isn't in GROUP BY

I add that and get xc.classid isn't in GROUP BY

I add that and go all the way down too -

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

This can't be correct is it? It does run but I suppose GROUP BY is handled a bit differently in MySQL 5 than 4 or perhaps my query was barely functional in four?

Was it helpful?

Solution

Apparently you have enabled ONLY_FULL_GROUP_BY mode

Just disable it and you can again be happy with this great mysql extension to GROUP_BY

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top