Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by
Message
From
14/02/2003 10:15:44
 
 
To
14/02/2003 09:28:58
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00753201
Message ID:
00753229
Views:
13
>Below is from the help file. If I understand this change I can nolonger just list the fields I want grouped. I have to list the field grouping of all the fields.
>
>So if I have table with 5 fields I must list all 5 as in
>"Group by 3,2,1,4,5" even if all I'm concern with is with fields 3 and 2. Can anybody confirm? TIA
>

More or less. It's always been bad design to have fields in the query that neither include an aggregate function or appear in the GROUP BY clause. You couldn't count on the data in those fields--VFP took it randomly from the last record in the group.

For example, the following query produces unexpected results:

SELECT Name, State, MAX(birthdate) ;
FROM People ;
GROUP BY State

You'd think it gives you the youngest person for each state, but in fact, it gives you the birthdate of the youngest person and the name of one person at random.

In VFP 8, they've tightened up the query engine to prevent you from writing that sort of query. However, because many of us have older code that does it, there's a new SYS() function and the SET ENGINEBEHAVIOR command to let you run such queries.

My recommendation is to use SET ENGINEBEHAVIOR only with older code, and to make sure all new code is compliant with the VFP 8 behavior.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform