Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need SQL Tricks
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00244102
Message ID:
00244106
Views:
16
>Hi All,
>
>I want to group items in a report by not a field but
>a part of field. For example useid is 12 digit number
>and 5th to 6th position indicate the are of this user.
>I want put sql code like Group by substr(userid,5,2).
>I tried that but VFP 6 does not seem to like it.
>Column not found error message comes on. Off cause
>this could be FoxFire's(I am beta testing Fox Fire)
> limitation that I don't know about.
>May be my approach is not permissable. If so is there
>any trick I can use to achieve this end.
>Thanks for your help always.
>
>Aiko Ichimura

You need to include the expression that you are grouping by and then GROUP BY the field number :-

SELECT Field1, Field2, substr(userid,5,2) ;
FROM YourTable ;
GROUP BY 3 ;
INTO CURSOR YourCursor

HTH
regards

Ian
Previous
Reply
Map
View

Click here to load this message in the networking platform