Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 8.0 - Select - SQL
Message
From
18/07/2003 18:43:50
 
 
To
18/07/2003 16:47:46
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00811460
Message ID:
00811717
Views:
15
>How do you group by a particular field using the Standard SQL? Any suggestions?

Like I said, you have to aggregate the other fields. Like:
Select Name, Max(Address), Max(Phone) from adtable group by name
I realize this seems to return nonsense, but the truth is, so would the vfp7 way.

When you group on one field in a list of fields, there is no guarantee of what records might populate the other fields. Either way you do it, the returned list of records will be grouped by 'name', but the address and phone information would be meaningless.

All MS did in trying to comply with the standards was to make it a bit more obvious that the information is meaningless. Previously, many people thought the information returned made sense, but if you look closely at it, what would be the relevance of giving say the last address record in the table with a record containing a name like 'Smith' that may have 50 records in the table but because of the grouping, only one has been returned? What is the relationship between the name Smith, and the address and phone returned by the select clause? Answer: There is none.

Alan
Previous
Reply
Map
View

Click here to load this message in the networking platform