Hello,
In the following query, an error is encountered in the execution:
select
fto.id_taxon,
fto.cd_sexo as fto_cd_sexo,
fto.cd_idade as fto_idade,
x.ftv_cd_sexo,
x.ftv_cd_idade,
x.id_fv
from
tb_foto_ocorrencia fto
left join (
select
ftv.id_taxon as id_t,
ftv.cd_sexo as ftv_cd_sexo,
ftv.cd_idade as ftv_cd_idade,
ftv.id_foto_ocorrencia as id_fo,
ftv.id_foto_validacao as id_fv,
sum(
case when ftv.id_taxon <> fto.id_taxon then 1 else 0 end
)
from
tb_foto_validacao ftv
group by
id_fo
) x on fto.id_foto_ocorrencia = x.id_fo
WHERE
fto.fl_validado = 'n'
ORDER BY
'fto'.'id_foto_ocorrencia' ASC
The error displayed is as follows:
1054 - Unknown column 'fto.id_taxon' in 'field list'
But as you can see in the query, the fields are defined.