1055 Expression #2 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'or038387_bsdnaen.pov.products_options_values_sort_order' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
in:
[SELECT count(DISTINCT p2a.products_id) as quantity, po.products_options_name, pov.products_options_values_name, SUM(IF(p2a.products_id IN(3979,4249,3739,3736,3950,3947,3984,3949,4068,4203,4224,4202,4248,4422,4521,4513,4588,4638,4645), 1, 0)) as flag FROM products_attributes p2a 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 po.products_options_id>2 and p2a.products_id IN (3736,3739,3947,3949,3950,3979,3984,4068,4202,4203,4224,4248,4249,4422,4513,4521,4588,4638,4645) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]