Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by - why?
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Group by - why?
Divers
Thread ID:
00914949
Message ID:
00914949
Vues:
44
Hello.
An excerpt from VFP8 Help:
"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. "

Let's see...
CREATE CURSOR test (pk c(32), nr n(3), txt M)
SELECT * from test GROUP BY 1
SELECT * from test GROUP BY 1,2
SELECT pk, nr, txt FROM test GROUP BY pk, nr
All of the SELECTs produce "GROUP BY clause is missing or invalid" result. You basically can't Group the cursor.
On the other hand
SELECT pk, nr, 000 as cn FROM test GROUP BY pk, nr, cn
SELECT pk, nr, 000 as cn FROM test GROUP BY pk, nr  && note no cn column
Is fine.

I find the GROUP BY innovation counterproductive. In VFP7 it worked like that (snap). Now i have to change not only the code of my Selects but also the code around them.
"The GROUP BY clause must list EVERY field..." - what is the reasoning behind this change?
To make Foxpro more in line with SQL server?
- Doesn't seem like that.
What do you think?
A moment of silence is our cosmic reset button.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform