Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change in SQL commands!
Message
 
 
À
13/09/2004 23:10:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00941771
Message ID:
00941774
Vues:
65
This message has been marked as the solution to the initial question of the thread.
The changes are documented in VFP8 help under Behavior Changes Since Visual FoxPro 7.0 and in INFO: SQL SELECT Behavior Changes in Visual FoxPro 8.0 mskb #813361.
You provide very good reason why those changes were made. Contrary to what you think, your query not necessary returns cJN2_2 from the record with MAX value of nJN2_1. Actually, it returns cJN2_2 from the last physical record. Run following code to see it for yourself
CREATE CURSOR jn2 (nJN2_1 I, cJN2_2 C(1))
INSERT INTO jn2 VALUES(3, "A")
INSERT INTO jn2 VALUES(2, "B")
INSERT INTO jn2 VALUES(1, "C")
SET ENGINEBEHAVIOR 70
SELECT MAX(nJN2_1) as MaxTime, cJN2_2 from jn2 TO CURSOR test
? MaxTime, cJN2_2    && Displays: 3 "C", not 3 "A" 
Here's one of the ways to get correct result
SET ENGINEBEHAVIOR 80
SELECT * from jn2 ;
  WHERE nJN2_1 = (SELECT MAX(nJN2_1) from jn2)
>In VFP7 this commend work:
>
>SELECT MAX(nJN2_1) as MaxTime, cJN2_2 from jn2
>
>In this command I can see Max of nJN2_1 and cJN2_2 that have Max Value.
>In VFP8 and VF9 when I run this command see an error:
>
>SQL: GROUP BY Clause is missing or invalid.
>
>Why? and if this command is changed, how we can know what record have Max Value!
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform