Subject | Re: [firebird-support] What is wrong? |
---|---|
Author | Alexandre Benson Smith |
Post date | 2004-08-02T19:03:33Z |
Francisco Antonio Vieira Souza wrote:
I don't understand you you expect with this query.
I suppose if you remove the group by part you will get what you want. I
assume you want tha max value of v.quantfinal for each :tarifa
SELECT
(SELECT MAX(v.quantfinal) FROM VALORTARIFAS t
WHERE t.codtabela=:tarifa) PESO_FINAL,
v.valorfaixa
FROM VALORTARIFAS v
WHERE v.codtabela = :tarifa
INTO :peso_final, :valor
DO
suspend;
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>beginFrancisco,
> FOR
> SELECT
> (SELECT MAX(v.quantfinal) FROM VALORTARIFAS t
> WHERE t.codtabela=:tarifa GROUP BY quantfinal) PESO_FINAL,
> v.valorfaixa
> FROM VALORTARIFAS v
> WHERE v.codtabela = :tarifa
> INTO :peso_final, :valor
> DO
> suspend;
>end
>
>Invalid token.
>Dynamic SQL Error.
>SQL error code = -104.
>Invalid expression in the select list (not contained in either an
>aggregate function or the GROUP BY clause).
>
>
I don't understand you you expect with this query.
I suppose if you remove the group by part you will get what you want. I
assume you want tha max value of v.quantfinal for each :tarifa
SELECT
(SELECT MAX(v.quantfinal) FROM VALORTARIFAS t
WHERE t.codtabela=:tarifa) PESO_FINAL,
v.valorfaixa
FROM VALORTARIFAS v
WHERE v.codtabela = :tarifa
INTO :peso_final, :valor
DO
suspend;
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br