1055 Expression #2 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'or038387_bsdnaen.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(3510,3511,3517,3515,3512,3514,3513,3516), 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 (1568,1715,3376,3377,3380,3382,3383,3384,3385,3386,3387,3388,3389,3390,3391,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3411,3413,3415,3416,3417,3419,3420,3424,3425,3426,3428,3429,3430,3431,3432,3433,3434,3435,3436,3437,3438,3442,3445,3446,3447,3448,3449,3450,3451,3452,3453,3454,3455,3456,3458,3459,3460,3461,3463,3464,3465,3466,3467,3468,3469,3470,3471,3472,3474,3475,3476,3479,3480,3481,3482,3483,3484,3485,3486,3487,3488,3489,3490,3491,3492,3494,3496,3497,3499,3500,3501,3502,3504,3510,3511,3512,3513,3514,3515,3516,3517,3518,3519,3520,3521,3522,3523,3524,3525,3526,3528,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541,3544,3545,3546,3547,3548,3549,3550) GROUP BY po.products_options_name, pov.products_options_values_name ORDER BY po.products_options_name, pov.products_options_values_sort_order]