1055 Expression #2 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'mi039208_eraevva.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(4946,4899,5026,5028,5034,5053,5084,5032,5025,5056,5065,4938,4876,5346,5269,4894,5091,5300,5256,5389,4873,649,648,5126,5387,5107,5073,5383,5155,5158,5092,5063,5378,5002,5003,4954,5268,4858,4878,4856,4874,5356,5080,5098,5367,5390,4931,4871,5144,5140,5043,5044,5087,5209,5211,5212,5141,5188,5272,5282,5286,5305,5347,5048,5176,5152,5118,5142,5153,5115,5171), 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 (648,649,4856,4858,4871,4873,4874,4876,4878,4894,4899,4931,4938,4946,4954,5002,5003,5025,5026,5028,5032,5034,5043,5044,5048,5053,5056,5063,5065,5073,5080,5084,5087,5091,5092,5098,5107,5115,5118,5126,5140,5141,5142,5144,5152,5153,5155,5158,5171,5176,5188,5209,5211,5212,5256,5268,5269,5272,5282,5286,5300,5305,5346,5347,5356,5367,5378,5383,5387,5389,5390) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]