Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL 7.0 vs 8.0
Message
 
 
To
15/04/2003 17:21:30
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00777961
Message ID:
00778112
Views:
31
Let's simplify what is really needed here. With VFP8, the SQL has been brought more in line with SQL used by DBs like SQL Server and Oracle. When a GROUP BY is used, the SQL engine expects EVERY field in the SELECT list in the GROUP BY list EXCEPT those that are aggregated with functions like SUM(), MAX() and MIN(). When you added the other fields from the SELECT list to the GROUP BY in your code, the error went away which is correct since none of your fields in the SELECT were aggregated. For example:

SELECT CustID, MAX(InvoiceAmount) FROM INVOICES
GROUP BY CustID

is correct. If you omitted the GROUP BY in the example, you would get 1 record with the maximum InvoiceAmount and a CustID, but you could not be assured the CustID represented the Customer with the highest InvoiceAmount.

When your SQL has no aggregate functions, any GROUP BY should include all fields in the SELECT list.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform