Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by - why?
Message
De
18/06/2004 06:37:32
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00914949
Message ID:
00914953
Vues:
8
Hello Kamil,

I found a reference to this url:http://support.microsoft.com/default.aspx?scid=kb;en-us;813361&Product=Vfp8

In that page it says: "Several changes are made to SQL SELECT statement behavior in VFP8 compared to earlier versions of Visual Fox Pro. The changes are designed to prevent ambiguous data that previous versions of Visual FoxPro (VFP) returned."

I think I have also heard that this change brings VFP's SQL syntax in line with the ANSI SQL standard which (if true) is better for VFP.

With your example...
SELECT * from test GROUP BY 1,2
...this is really a bit unclear as to what you expect to have returned. I'm also not sure why you would want to group by in that context without specifying all fields. If you had 2 records, with the same data in pk & nr but something different in field txt and you grouped by just fields 1 & 2, then you would lose that difference.

In this situation you could have the syntax SELECT pk, nr, MAX(txt) GROUP BY 1,2

I think the example...
SELECT pk, nr, 000 as cn FROM test GROUP BY pk, nr && note no cn column
...works because VFP views the 000 as cnt as being an aggregate field, or perhaps it recognises that it isn't a field from the original selection.

Lastly, there is the command SET ENGINEBEHAVIOR 70, which makes VFP revert to the old standard. However I don't think that should be a permanent solution.

Stewart
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform