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(6507,6651,6727,6753,6123,6566,6914,6922,5600,147,437,469,749,1093,1295,1777,2291,2871,3047,3082,3413,3743,3970,4081,4170,4592,375,1173,1325,1365,1583,1965,3249,4883,4895,5556,5640,5755,5969,804,1529,1661,1854,2487,2944,3588,5396,5441,5592,5848,4517,2841,3265,5780,4271,1880,405,1089,1277,2938,2943,3206,3352,3464,3758,3856,3860,5082,5145,513,1229,1810,1824,2669,2732,3001,3060,3429,4358,4379,4649,874,2601,4124,4738,960,354,602,2099,3442,3512,3973,4675,5059,4275,4621,689,2578,5435,3398,4116,5013,5406,2101,2517,4885,1110,5641,4897,239,4353,5369,569,3562,225,4527,5103,5230,5329,5480,125,756,4160,5251,451,1940,3007,3580,3770,3800,4701,4765,5010,5139,5355,11,1145,2547,2772,3107,3117,4146,1597,709,1410,1973,2808,2992,4736,5303,5791,902,271,2717,1182,2614,3165,3366,4040,5130,5579,5872,3354,58,2221,2232,275,1883,2571,3433,5324,5392,1813,3191,3567,3089,3711,3834,1256,197,1399,1449,2588,2831,2986,3068,4774,597,1786,1170,2991,3368,3935,2199,2330,3917,4320,460,1008,1522,1674,2534,3493,4288,4387,4680,1178,4652,73,3546,3644,4840,1894,2303,5364,185,955,3291,4602,859,1308,3175,2848,950,3796,3858,4182,4779,1768,2080,3421,4576,100,1215,1873,2661,3285,5212,5420,5728,44,1203,4331,580,1059,3002,3624,4400,5146,5186,409,943,1340,1784,1785,2020,2151,2585,3707,3756,4843,5086,5224,5828,212,2391,5240,340,2107,2421,2490,2801,3399,3679,4502,5505,5574,5790,50,2031,3172,3531,358,620,1445,1475,2397,2586,3663,3823,3861,4555,5748,4410,1342,137,260,313,1227,1981,2090,2156,2250,2580,2659,3139,3177,3384,3972,5075,5553,114,505,1037,3299,3319,3576,3584,3602,3636,4207,4745,5025,5044,5414,2966,664,1120,1287,1302,2053,2548,3420,3560,5491,5616,5688,5849,167,2745,4650,4744,445,595,1774,2198,3105,3321,1943,2365,3465,431,1681,2520,3318,3351,3951,4342,4799,2668), 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 (409,1340,2020,5086,212,2151,3707,5828,44,147,197,225,239,271,275,354,405,437,460,569,602,859,874,960,1008,1059,1089,1093,1110,1178,1182,1203,1229,1256,1277,1308,1325,1365,1522,1583,1597,1674,1810,1854,1880,1883,1965,1973,2099,2291,2391,2534,2571,2614,2717,2732,2848,2871,2938,2943,2944,2992,3002,3047,3060,3082,3117,3165,3175,3249,3291,3352,3354,3433,3442,3464,3493,3512,3562,3624,3758,3973,4040,4170,4271,4275,4288,4331,4353,4379,4387,4527,4602,4621,4649,4652,4675,4680,4736,4738,4840,4883,4897,5059,5082,5103,5145,5146,5186,5230,5240,5251,5324,5329,5369,5392,5480,5600,5640,5641,5728,5791,5848,5969,11,58,73,100,125,185,375,451,469,513,580,597,689,709,749,756,804,950,955,1145,1170,1173,1215,1295,1399,1410,1449,1529,1661,1768,1777,1786,1813,1824,1873,1894,1940,2080,2101,2199,2221,2232,2303,2330,2487,2517,2547,2578,2588,2601,2661,2669,2772,2808,2831,2841,2986,2991,3001,3007,3068,3089,3107,3191,3206,3265,3285,3366,3368,3398,3413,3421,3429,3546,3567,3580,3588,3644,3711,3743,3770,3796,3800,3834,3856,3858,3860,3917,3935,3970,4081,4116,4124,4146,4160,4182,4320,4358,4400,4517,4576,4592,4701,4765,4774,4779,4885,4895,5010,5013,5130,5139,5212,5303,5355,5364,5396,5406,5420,5435,5441,5556,5579,5592,5755,5780,5872,943,1785,5224,431,1681,2520,2668,3318,3351,3951,4342,4799,1784,2585,3756,137,313,340,358,445,595,620,1120,1342,1445,1475,1943,2053,2107,2156,2250,2397,2490,2580,2745,2801,3139,3319,3321,3420,3465,3584,3602,3636,3663,3823,3861,4410,4502,4744,5025,5505,5574,5616,5688,5790,902,50,114,167,260,505,664,1037,1227,1287,1302,1774,1981,2031,2090,2198,2365,2421,2548,2586,2659,2966,3105,3172,3177,3299,3384,3399,3531,3560,3576,3679,3972,4207,4555,4650,4745,5044,5075,5414,5491,5553,5748,5849,4843,6123,6651,6727,6914,6507,6566,6753,6922) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]