× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Right on - of course, in this case, he wants aggregates for the "group" that is the entire table. So he can't name any columns. ;-)

Also, literals (constants) that are specified in the field list do not need to be in the GROUP BY clause.

Vern

At 11:45 AM 8/9/2004, you wrote:
Adding to what Bob said... You Must use Group By if you want to mix Aggregate Fields and non-Aggregate Fields in the Same Select. So if you want to Select:

Customer Name, Customer Number and July MTD Sales from your Order File you might code:

Select CuName, CuNmbr, Sum(OrdTot) From Orders
Where CuNmbr = 100 and OrdDate >= 20040701 And OrdDate <= 20040731
Group By CuName, CuNmbr


Mike


The Group By would give you a resulting row for each group of records. If you have only one group of records your Where selection takes care of getting only one group and therefore only one resulting row.

Bob Kohlndorfer
Unbeaten Path International
----- Original Message -----
From: "Dan Bale" <dbale@xxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Sent: Monday, August 09, 2004 9:24 AM
Subject: RE: Using SQL to get a one total row from multiple rows


I guess I was expecting to use something along the lines of GROUP BY. I seem to recall using that before to do summary-type results.

But I probably mismember.

Thanks for the confirmation.

db



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.