Hello,

2008/4/28, Saul Lima <[EMAIL PROTECTED]>:
> I'm creating a query that have to return the sum of payment in a month...
>  but, that is returning this error:
>
>  Status SQL: 37000
>  Código de erro: -67
>
>  Not in aggregate function or group by clause:
>  [EMAIL PROTECTED] statement [SELECT
>  "pagamentos"."MesRef", "pagamentos"."AnoRef", SUM(
>  "planos"."Valor" ) FROM "pagamentos", "planos" WHERE "pagamentos"."MesRef" =
>  :Mês AND "pagamentos"."AnoRef" = :Ano]
>
>  How I can do to correct this?
I think taht all fields that are not part of an aggregate function
must be added to the GROUP BY clause.
Something like :

SELECT "pagamentos"."MesRef", "pagamentos"."AnoRef",
SUM("planos"."Valor" ) FROM "pagamentos", "planos" WHERE
"pagamentos"."MesRef" = :Mês AND "pagamentos"."AnoRef" = :Ano] GROUP
BY "pagamentos"."MesRef", "pagamentos"."AnoRef"

Manuel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to