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(4416,2113,3698,1375,1630,1754,1818,2545,3963,4995,1044,4236,563,1949,2863,777,3273,5199,118,1570,1945,3239,857,1409,3196,1601,1488,3081,4800,2017,2774,1073,5700,2479,3627,4687,4503,1996,2051,4565,1760,3739,3005,3722,3924,867,5935,808,1080,985,2186,2532,2817,5557,1715,3216,5639,4230,3788,4783,1665,4053,4256,1848,4528,5876,4115,5294,3641,3971,5939,182,2565,2313,3364,219,2161,414,548,2605,754,340,2107,2421,2490,2801,3399,3679,4502,5505,5574,5790,50,2031,3172,3531,4964,85,3149,3742,5433,5813,248,727,1333,1632,1779,2206,2646,2753,2957,3251,3475,4513,5604,1123,1226,4373), 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 (118,182,219,414,563,777,808,857,1080,1409,1570,1665,1715,1760,1848,1945,1949,1996,2051,2161,2186,2313,2532,2565,2817,2863,3005,3081,3196,3216,3239,3273,3627,3641,3722,3788,3924,4115,4503,4528,4565,4687,4783,4800,5199,5294,5639,5876,4964,85,248,340,727,1632,1779,2107,2206,2490,2753,2801,3251,4373,4502,4513,5433,5505,5574,5790,5813,985,2017,4236,1375,1630,1754,1818,2113,2545,3698,3963,4995,548,754,867,1044,1073,1488,1601,2479,2605,2774,3364,3739,3971,4053,4230,4256,5557,5700,5935,5939,50,1123,1226,1333,2031,2421,2646,2957,3149,3172,3399,3475,3531,3679,3742,5604,4416) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]