Antonio Fernandez-Vicenti wrote:
Thinking about Query/400, you can define a query to bring detail lines as well as summary data. Of course, once defined, you can select to run the query just for summary only, or execute showing detail lines and summary data in between. In any case, you get Grand Totals at the end.
To be more accurate, Query -reports- both detail and summary. That is also the easier answer to your question, just create a detail SQL statement and the report writer will report the summary as well.

To actually get both in an SQL statement can be done, but it'd be quite a bit of work. Basically, you join a summarized data set to your detail. Here's one way:

With SumData(Select field1, field2, sum(field3) as sumfield From somefile Group by field1, field2)
Select dtl.field1, dtl.field2, dtl.field3, sumdata.field3
From somefile dtl join SumData on dtl.field1=sumdata.field1 and dtl.field2=sumdata.field2

Bill

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.