Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'ciafa_manual.t4.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
-- SELECT t20.id 'plaga_id', t20.nombre 'plaga_nombre' FROM
-- plagas t20
-- INNER JOIN cultivosplagas_nombrescientificos t21 ON (t20.id = t21.id_cultivoplaga AND t21.tipo_relacion = 'plaga')
-- INNER JOIN
-- (
select
distinct t4.id 'plaga_id', t4.nombre 'plaga_nombre', t4.nombre_cient 'plaga_cient'
from cultivos t1
inner join plagas_cultivos_prinact t2 on (t1.id = t2.fk_cultivo_id)
inner join principios_activos t3 on (t3.id = t2.fk_principios_activos_id)
inner join plagas t4 on (t4.id = t2.fk_plaga_id)
-- inner join cultivosplagas_nombrescientificos t5 on (t4.id = t5.id_cultivoplaga)
INNER JOIN productos t6 ON (t2.fk_principios_activos_id = t6.fk_principio_activo_id)
where
t3.fk_linea_tipo in (0,1)
and t1.active = 1
and t2.active = 1
and t3.active = 1
and t4.active = 1
and t6.active = 1
group by plaga_nombre order by plaga_nombre asc