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(1816,4544,2638,2736,3474,2873,5495,513,1229,1810,1824,2669,2732,3001,3060,3429,4358,4379,4649,4897,100,1215,1873,2661,3285,5212,5420,3109,5358,70,243,336,455,577,744,988,1039,1663,1790,2746,2987,3160,3747,4601,4714,4805,4841,5012,5247,5475,5482,5516,5766,5817,2312,122,645,987,1050,1377,2361,2560,3460,3797,4001,4337,4699,5100,5215,5561,5585,1020,2556,3995,5770,1293,540,145,195,1898,2301,7,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,2036,33,310,500,674,1154,1383,1647,1704,1966,2011,2810,2839,2921,3550,3695,4831,5083,5517,5649,5715,5763,194,475,1297,1680,1856,2342,2358,2589,3773,4458,4639,5653,5807,4373,2000,2323,2874,2907,771,1541,1296,3453,4023,4198,1741,1367,2132,4619,5253,5366,228,906,1499,2837,3013,3045,3108,3820,3867,4678), 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 (1367,7,70,122,145,195,540,577,744,987,1020,1039,1050,1229,1293,1790,1810,1898,2312,2556,2732,2746,2873,3060,3160,3474,3747,3995,4379,4601,4649,4699,4805,4841,4897,5100,5215,5247,5475,5482,5495,5516,5561,5585,5766,5770,100,243,336,455,513,645,988,1215,1377,1663,1824,1873,2301,2361,2560,2638,2661,2669,2736,2987,3001,3109,3285,3429,3460,3797,4001,4337,4358,4714,5012,5212,5358,5420,5817,1296,1741,2132,3453,4023,4198,4619,5253,5366,33,194,310,445,595,1120,1154,1297,1704,1856,1943,2036,2053,2323,2589,2745,2810,2874,2921,3321,3420,3695,4373,4458,4639,4744,5083,5517,5616,5649,5688,5715,167,475,500,664,674,1287,1302,1383,1647,1680,1774,1966,2000,2011,2198,2342,2358,2365,2548,2839,2907,2966,3105,3550,3560,3773,4650,4831,5491,5653,5763,5807,5849,1816,4544,228,1499,3013,3045,3108,3867,906,2837,3820,4678,771,1541) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]