Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is this a BUG?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00798818
Message ID:
00798827
Vues:
24
Hi Borislav,

It's not a bug. The NVL function isn't aggregate function that's why you get an error. When FoxPro process expression SUM(NadvDoo + SumaDoo) + NVL(AddSum.Bruto,0) it sums 'NadvDoo + SumaDoo' for each record. The NVL(AddSum.Bruto,0) part referes to the single record so FoxPro wouldn't know from which record in the group to take this value.

>I read carefully what the help sais about SET ENGINEBEHAVIOR 70 | 80 & what are the diferences between VFP 7.0 & 8.0 in GROUP BY clause. Help sais"
>
>********
>The GROUP BY clause must list every field in the SELECT list except for fields contained in an aggregate function, such as the COUNT( ) function. In addition, the GROUP BY clause must also list every field in a HAVING clause except for fields contained in an aggregate function.
>*********
>
>I have the following example:
>CLOSE DATABASES ALL
>CREATE TABLE DooSumi (NadvDoo N(14,2), SumaDoo N(14,2), Mes N(2), God N(4), Egn C(10))
>CREATE TABLE AddSum (Bruto N(14,2), Mes N(2), God N(4), Egn C(10))
>INSERT INTO DooSumi (NadvDoo, SumaDoo, Mes, God, Egn) VALUES (100, 50, 2, 2003, "1111111111")
>INSERT INTO DooSumi (NadvDoo, SumaDoo, Mes, God, Egn) VALUES (120, 50, 2, 2003, "1111111111")
>INSERT INTO DooSumi (NadvDoo, SumaDoo, Mes, God, Egn) VALUES (120, 50, 2, 2003, "1111111111")
>
>INSERT INTO AddSum (Bruto, Mes, God, Egn) VALUES (100, 2, 2003, "1111111111")
>
>SELECT SUM(NadvDoo + SumaDoo) + NVL(AddSum.Bruto,0) AS All_Nadv;
>       FROM DooSumi;
>       LEFT JOIN AddSum ON DooSumi.Egn+STR(2003,4)+STR(2,2) == AddSum.Egn + STR(AddSum.God,4)+STR(AddSum.Mes,2);
>       WHERE DooSumi.Egn == "1111111111" .AND. DooSumi.Mes == 2 .AND. DooSumi.God == 2003;
>       GROUP BY DooSumi.Egn, DooSumi.Mes, DooSumi.God;
>INTO CURSOR TempDoo
>and VFP 8.0 rises the error SQL: GROUP BY clause is missing ot invalid"
>when I remove "+NVL(AddSum.Bruto, 0)" everything is OK. I thing the All_Nadv Field in TempDoo IS agregate, but maybe I am wrong ???
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform