1055 Expression #2 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'co038478_hsrts.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(2276,325,2765,3222,5647,176,944,1366,1673,2431,3516,3965,4500,5255,5261,5514,5662,1590,1946,3103,5797,248,727,1333,1632,1779,2206,2646,2753,2957,3251,3475,4513,5604,1123,1226,194,475,1297,1680,1856,2342,2358,2589,3773,4458,4639,5653,5807,4373,2000,2323,2874,2907,3095,2892,2132,4619,5253,5366,1727,2454,503,164,1496,3338,5833,1486,4972,5487,5914,6136,6729), 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 (164,1496,2132,2892,3095,3338,4619,5253,5366,5833,176,194,248,727,1297,1590,1632,1673,1779,1856,1946,2206,2323,2431,2589,2753,2874,3103,3251,3516,4373,4458,4513,4639,5261,5514,5797,475,944,1123,1226,1333,1366,1680,2000,2342,2358,2646,2907,2957,3475,3773,3965,4500,5255,5604,5653,5662,5807,325,2276,2765,3222,5647,503,1486,1727,2454,4972,5487,5914,6136,6729) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]