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(1223,1232,1233,1297,1312,1311,1257,1265,1316,1215,1337,1218,1279,1332,1248,1226,1225,1285,1308,1221,1222,1227,1230,1291,1296,1236,1238,1237,1334,1268,1270,1271,1269,1287,1266,1267,1276,1317,1338), 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 (1215,1218,1221,1222,1223,1225,1226,1227,1230,1232,1233,1236,1237,1238,1248,1257,1265,1266,1267,1268,1269,1270,1271,1276,1279,1285,1287,1291,1296,1297,1308,1311,1312,1316,1317,1332,1334,1337,1338) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]