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(1201,2467,2627,2918,5457,1869,2529,1520,5153,6654,3128,242,277,2468,3611,6695,579,1836,4135,1471,2010,2937,3955,682,1611,2324,2869,4226,4580,4833,5825,94,1045,1444,3142,1111,5539,6376,6227,6262,6303,6923,302,1822,4973,2795,3988,5081,5714,5858,1006,2113,3698,1375,1630,1754,1818,2545,3963,4995,818,978,1094,1286,2164,2641,3824,95,205,2145,3381,3025,4025,3795,3621,5114,962,2293,47,285,473,2703,2873,5495,480,692,1702,2481,4176,5581,3457,841,1354,1244,4485,305,4391,5173,2160,282,879,1247,1729,2025,4598,546,1957,2544,2057,5595,5617,6147,6687,6789,3802,4463,4893,5573,861,4795,2877,5867,99,1726,2443,3259,2572,4456,2633,4980,359,591,4227,5382,281,3394,4534,4838,5371,5437,1493,4392,2741,2154,2621,3342,5395,1097,2204,1293,4473,2980,2813,6568,6746,4807,6904,5972,365,997,2579,4848,3805,4894,5308,6580,6780,6801,6226,6260,6293,6340,6388,6881,6102,6175,6396,6597,932,2679,3966,5174,5252,5589,926,3147,3947,3359,5624,1210,1087,1767,2326,3014,3185,5019,52,361,683,1119,2469,2505,4622,5090,5417,1650,1805,2974,3478,1233,2387,3830,4617,5694,1600,2786,4024,4847,237,2044,2645,4048,5399,3408,3746,1498,2860,356,4345,1787,4087,3920,575,1426,1179,3271,121,3817,5321,771,1541,5196,5866,421,4442,5684,2097,2348,1260,5850,4172,135,3146,3365,4242,5895,1431,1639,2268,4109,1330,3217,3749,4430,2043,2333,3492,4202,5218,1753), 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 (237,365,682,926,997,1471,1611,1650,1805,2010,2044,2579,2641,2795,2937,3128,3147,3611,3947,3955,3988,4580,4848,5081,5714,5825,5858,3146,4242,302,356,359,361,575,579,591,1006,1119,1179,1201,1426,1431,1639,1787,1822,1836,2268,2467,2469,2627,2633,2679,2918,3185,3359,3621,3795,3802,3920,3966,4087,4109,4135,4227,4345,4463,4622,4893,4973,4980,5090,5174,5196,5252,5382,5417,5457,5573,5624,5866,47,281,282,285,305,473,546,692,879,962,1097,1244,1247,1293,1493,1729,1957,2025,2057,2204,2293,2481,2544,2621,2703,2741,2873,2980,3342,3394,4176,4391,4392,4473,4485,4534,4598,4838,5173,5371,5395,5437,5495,5595,5617,99,480,841,861,1354,1702,1726,2443,2572,2877,3259,3457,4456,4795,5114,5581,5867,683,1600,2324,2333,2505,2645,2786,2974,3271,3478,3805,4024,4048,4833,4847,4894,5218,5308,5399,421,1260,2326,2387,2869,3014,3365,4172,4226,4442,4617,5019,5684,5694,5850,5895,94,95,205,242,277,1045,1111,1375,1444,1520,1630,1754,1818,1869,2113,2145,2529,2545,3142,3381,3698,3963,4995,5153,5539,1094,1286,2164,3025,4025,2160,121,3817,5321,52,978,1210,2097,2348,2468,3408,3746,3824,135,818,932,1087,1233,1767,2154,3492,3830,4202,4807,5589,5972,771,1330,1541,1753,3217,3749,4430,2043,2813,1498,2860,6102,6147,6175,6226,6227,6260,6262,6293,6303,6340,6388,6396,6580,6597,6654,6687,6695,6780,6789,6801,6881,6568,6746,6904,6376,6923) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]