Subject Re: sql error - invalid column reference
Author ronaldorezende
Is there a way to put the "extract(year from c.DATA_INICIO) Ano" in
the group by or in the list of columns?



--- In ib-support@yahoogroups.com, "Martijn Tonies" <m.tonies@u...> wrote:
>
> When using a GROUP BY, or SUM or other aggregate
> function, you need to use one on each column.
>
> Both of these columns are not mentioned in the GROUP BY
> clause.
>
>
> > Hi, I receive this error when I put this two fields in sql.
> > d.DESCRICAO_DISCIPLINA_PADRAO,
> > extract(year from c.DATA_INICIO) Ano
> >
> >
> > select
> > da.ID_CURSO,
> > da.ID_DISCIPLINA,
> > da.ID_ALUNO,
> > sum(da.NOTA_DIARIO) Nota,
> > sum(da.QTD_FALTA_DIARIO) Faltas,
> > d.DESCRICAO_DISCIPLINA_PADRAO,
> > extract(year from c.DATA_INICIO) Ano
> > from DIARIO_ALUNO da
> > left join DISCIPLINA d on d.ID_DISCIPLINA = da.ID_DISCIPLINA
> > left join CURSO c on c.ID_CURSO = da.ID_CURSO
> > where da.ID_ALUNO = :id_aluno and da.ID_CURSO = :id_curso
> > group by da.ID_CURSO, da.ID_DISCIPLINA, da.ID_ALUNO
>
>
> With regards,
>
> Martijn Tonies
> Database Workbench - the developer tool for InterBase & Firebird
> Upscene Productions
> http://www.upscene.com
>
> See you at the First European Firebird Conference in May in Fulda,
Germany
> http://www.firebird-conference.com