Expression #11 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'hirlevel.r.relid' 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 (47, 48, 9, 3, 4) GROUP BY ORDER BY r.dorder ASC