|
I am an SQL newbie, we have only had SQL for 9 days now. I am trying to
read the manuals, but they are not answering a question.
We have been asked to total up transaction records, (different trans types,
4 different amounts on each record). They want the total of each column, by
each trans type and then the foot of all the columns, with all the totals
printed on a report.
I have figured out how to do this with the STRSQL command, (one column and
one trans type at a time) but not how to do it with SQLRPGLE. Here is my
program, but the SQL precompiler said that I needed a SELECT INTO statement.
How do I get the Sum(field name) into a field for doing further calculations
(Total) ?
FQPRINT O F 80 Printer OFLIND(*INOF)
D Total S 15S 2 Inz(0)
*--------------------------------------------------------------------
C/Exec Sql
C+ select Sum(T2ANVA) Amount
C+ From NEWHUD/TNTRTH
C+ Where T2HSDT >= 1000701 and T2BICD = '01' Date & Trans Type
C/End-Exec
C Except #detail
C Eval *INLR = *On
OQprint E #Detail
O Total 4 35
Do I make any sense ? I don't want to do this with plain RPGIV or WRKQRY, I
really want to use this new functionality. Can someone please give me a
clue ? I have three SQL manuals from IBM, and the SQL tutorial from
News/400.
TIA,
Cyndi B.
Boise, ID
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.