Erro SQL com Firebird 1.5
Tenho um select que esta dando o seguinte erro:
<b>Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause).</b>
===============================================
select a.tipavlcod, (avg(a.avanot) *
(select t.avapes from tipavaliaturma t
where t.trmcod = a.trmcod
and t.discod = a.discod
and t.tipavlcod = a.tipavlcod
) ) as Media
from avaliaturma a
where a.trmcod = :Turma
and a.discod = :Dis
and a.mtrnum = :Matr
group by a.tipavlcod
===============================================
Agradeço se alguém puder Ajudar-me.[/b]
<b>Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause).</b>
===============================================
select a.tipavlcod, (avg(a.avanot) *
(select t.avapes from tipavaliaturma t
where t.trmcod = a.trmcod
and t.discod = a.discod
and t.tipavlcod = a.tipavlcod
) ) as Media
from avaliaturma a
where a.trmcod = :Turma
and a.discod = :Dis
and a.mtrnum = :Matr
group by a.tipavlcod
===============================================
Agradeço se alguém puder Ajudar-me.[/b]
Mkoch
Curtidas 0
Respostas
Sremulador
05/01/2005
seu problema esta aqui
select a.tipavlcod, (avg(a.avanot) *
[b:3a0d3b1179](select t.avapes from tipavaliaturma t
where t.trmcod = a.trmcod
and t.discod = a.discod
and t.tipavlcod = a.tipavlcod
) ) as Media [/b:3a0d3b1179]from avaliaturma a
where a.trmcod = :Turma
and a.discod = :Dis
and a.mtrnum = :Matr
group by a.tipavlcod
tente fazer isso
select a.tipavlcod, (avg(a.avanot) *
[b:3a0d3b1179](select t.avapes from tipavaliaturma t
where t.trmcod = a.trmcod
and t.discod = a.discod
and t.tipavlcod = a.tipavlcod
) ) as Media [/b:3a0d3b1179]from avaliaturma a
where a.trmcod = :Turma
and a.discod = :Dis
and a.mtrnum = :Matr
group by a.tipavlcod, Media
select a.tipavlcod, (avg(a.avanot) *
[b:3a0d3b1179](select t.avapes from tipavaliaturma t
where t.trmcod = a.trmcod
and t.discod = a.discod
and t.tipavlcod = a.tipavlcod
) ) as Media [/b:3a0d3b1179]from avaliaturma a
where a.trmcod = :Turma
and a.discod = :Dis
and a.mtrnum = :Matr
group by a.tipavlcod
tente fazer isso
select a.tipavlcod, (avg(a.avanot) *
[b:3a0d3b1179](select t.avapes from tipavaliaturma t
where t.trmcod = a.trmcod
and t.discod = a.discod
and t.tipavlcod = a.tipavlcod
) ) as Media [/b:3a0d3b1179]from avaliaturma a
where a.trmcod = :Turma
and a.discod = :Dis
and a.mtrnum = :Matr
group by a.tipavlcod, Media
GOSTEI 0
Mkoch
05/01/2005
Já temtei assim como você sugeriu mas da o erro
´Column does not belong to referenced table.
Dynamic SQL Error.
SQL error code = -206.
Column unknown.
MEDIA.
At line 38, column 23.´
´Column does not belong to referenced table.
Dynamic SQL Error.
SQL error code = -206.
Column unknown.
MEDIA.
At line 38, column 23.´
GOSTEI 0