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(471,495,1653,1656,1654,1155,448,449,454,455,458,459,460,1668,2211,1680,2444,1163,1165,861,860,867,1697,2450,1666,854,856,866,872,1727,542,2489,633,1699,1705,465,476,467,470,481,480,1173,486,482,499,496,501,1709,508,509,526,1210,524,527,528,531,532,869,244,246,250,249,2474,644,2477,899,900,901,2060,2061,891,877,538,500,1745,1746,913,914,253,916,926,821,931,930,881,907,1178,1179,1182,2502,1748,1651,1676,1675,1677,1690,1691,1695,1708,1712,1732,1742,1741), 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 (244,246,249,250,253,448,449,454,455,458,459,460,465,467,470,471,476,480,481,482,486,495,496,499,500,501,508,509,524,526,527,528,531,532,538,542,633,644,821,854,856,860,861,866,867,869,872,877,881,891,899,900,901,907,913,914,916,926,930,931,1155,1163,1165,1173,1178,1179,1182,1210,1651,1653,1654,1656,1666,1668,1675,1676,1677,1680,1690,1691,1695,1697,1699,1705,1708,1709,1712,1727,1732,1741,1742,1745,1746,1748,2060,2061,2211,2444,2450,2474,2477,2489,2502) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]