Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 8.0 - Select - SQL
Message
From
23/07/2003 12:44:13
 
 
To
23/07/2003 12:10:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00811460
Message ID:
00812832
Views:
13
Unless you really want to group by a Memo field, which doesn't seem to make a lot of sense anyway, my suggestion is just forget about it. VFP8 doesn't support Memo fields in a 'group by' clause. But even using Set EngineBehavior 70 and putting the Memo field into the 'group by' wouldn't yield anything useful anyway. Why waste the resource on it?

When you select 5 fields and group on only 3 of them the information returned in the other 2 may be nothing more than the contents of the last record. There is certainly no guarantee that the information in those 2 fields will have any relationship whatever to the information in the fields that were grouped on, other than probably being the contents of at least one of the records that was looked at in creating the group, so why bother with them at all?

Alan

>What would you do if you had a MEMO field as part of the non aggregate statement in VFP7. I can't return MAX of that. Nor can I add that to the GROUP BY statement. Is there any other way to make it aggregate?
>
>
>>>I am not sure I understand your suggestions, could you give me a sample line of code? Thanks for your time.
>>
>>3 options: Not all applicable in all situations.
>>
>>ORIGINAL
>>
>>SELECT name_line1, first_name, last_name FROM accounts ;
>>WHERE NOT EMPTY(last_name) ;
>>GROUP BY name_line1 ;
>>ORDER BY last_name INTO ARRAY aClientNames
>>
>>
>>ELIMINATE NON-GROUPED FIELDS FROM FIELD LIST
>>
>>SELECT name_line1 FROM accounts ;
>>WHERE NOT EMPTY(last_name) ;
>>GROUP BY name_line1 ;
>>ORDER BY last_name INTO ARRAY aClientNames
>>
>>
>>ADD AGGREGATE FUNCTIONS TO NON-GROUPED FIELDS
>>
>>SELECT name_line1, MAX (first_name), MAX (last_name) FROM accounts ;
>>WHERE NOT EMPTY(last_name) ;
>>GROUP BY name_line1 ;
>>ORDER BY last_name INTO ARRAY aClientNames
>>
>>
>>ADD NON-GROUPED FIELDS TO GROUP BY CLAUSE
>>
>>SELECT name_line1, first_name, last_name FROM accounts ;
>>WHERE NOT EMPTY(last_name) ;
>>GROUP BY name_line1, first_name, last_name  ;
>>ORDER BY last_name INTO ARRAY aClientNames
>>
>>
>>In your example, which, if I understand correctly, only 1 first and last name can possibly be returned with name_line1, this syntax would appear to be redundant. In most cases, it isn't.
>>
>> HTH,
>> Jay
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform