|
Vern
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 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.