Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'pickupzu_hardtop_campaign.r.dorder' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by: SELECT f.*, r.relid, '' AS val, 0 AS dataid FROM `em_list_field` f, `em_list_field_rel` r WHERE = r.fieldid AND r.relid IN (0) GROUP BY ORDER BY r.dorder ASC