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(5731,2140,3377,4694,5759,2014,5594,394,1430,1885,2827,2310,4375,5681,250,1913,2034,5123,695,3962,543,2523,4247,4332,4749,5580,5785,2920,3874,4325,2638,2736,3657,5520,5158,3717,528,614,717,798,2698,4423,4977,5018,5529,4174,1407,2734,5861,2504,3190,3474,102,4960,415,4474,4656,353,5600,3798,1004,4982,1657,3086,5101,263,608,613,1623,1635,2958,3623,4201,4623,4705,5304,5347,5950,2708,3831,5205,4270), 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 (353,528,543,613,614,717,798,1407,1623,1635,2504,2523,2698,2734,2920,3190,3377,3474,3657,3874,4174,4201,4247,4325,4332,4694,4749,4977,5018,5158,5304,5520,5580,5600,5731,5785,5950,263,608,2958,3623,4623,4705,5347,102,250,394,415,695,1430,1885,1913,2014,2034,2140,2310,2638,2708,2736,2827,3717,3962,4375,4423,4474,4656,4960,5123,5529,5594,5681,5759,5861,3831,4270,5205,1004,1657,3086,3798,4982,5101) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]