Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Do You All Handle Group By Command
Message
From
01/08/2006 11:51:58
 
 
To
31/07/2006 15:32:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01141909
Message ID:
01142124
Views:
9
Hi Everyone,

Thanks for the responses. Since the first couple of SELECTs I needed to update were SELECTs against a an existing cursor, it was easy enough to write a function to return me a string of the underlying fields - with the "real" GROUP BY field first (don't jump on me for saying "real"!). This was the quick way to retrofit without having to use SET ENGINEBEHAVIOUR on and off whereever I did not want to retrofit. I already had a function that returned a list of all the fields for a table or cursor and so I just had to modify it to pass in the fields that I wanted to be first in the string.

This turned out to be fairly quick. Here is some of the code:
* assume over cursor that is the data source
STORE MakeFieldsList("File_ID, Partner_ID") TO lcGroupByClause

* above returns a string like "File_ID, Partner_ID, Lastname, Firstname..."

SELECT ;
   <whole wack o' fields...> ;
   FROM SomeCursor ;
   GROUP BY &lcGroupByClause
   INTO CURSOR Temp
This seems to be neat and tidy for the retrofits that I have first run into. All the "extra" group by fields pretty well are identical so too bad there is not an Any() function like Dragan suggested.

Thanks again.

Albert
Previous
Reply
Map
View

Click here to load this message in the networking platform