Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by - why?
Message
From
18/06/2004 05:55:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Group by - why?
Miscellaneous
Thread ID:
00914949
Message ID:
00914949
Views:
45
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.
Next
Reply
Map
View

Click here to load this message in the networking platform