Thanks John.
That worked exactly as I wanted.
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3
----- Original Message ----
From: John Arnold (MFS) <jarnold@xxxxxxxxxxxxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Sent: Friday, May 9, 2008 12:59:09 PM
Subject: RE: Sql Question - Case within Case
Case when DbApP_Tran_Chk_Amt = 0 then ' '
when DBAPD_ORIG_TRAN_AMT > 0 Then 'IN' Else 'CM' End
Will set the value to spaces whenever the paid amount is zero and set
the value based on the other amount.
John Arnold
(301) 354-2939
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Friday, May 09, 2008 12:40 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Sql Question - Case within Case
The SQL interperter allows me to do this:
select dbapd_vendor,dbapd_invoice,
DbApP_Tran_Chk_Amt,DBAPD_ORIG_TRAN_AMT,
Case DbApP_Tran_Chk_Amt When 0 then ' ' Else
Case When DBAPD_ORIG_TRAN_AMT > 0 Then 'IN' Else 'CM' End end
H_Type from dbapapd join dbapapp on dbapd_company = dbapp_company
and dbapd_vendor = dbapp_vendor and dbapd_invoice = dbapp_invoice
WHERE DBAPD_COMPANY = 101 AND DBAPD_CANCEL_SEQ = 0 and dbapd_distri
b_date > 20061231
However, the results are not what I am seeking:
VENDOR INVOICE TRAN
ORIG H_TYPE
CHK
TRAN
AMT
AMT
4830 22012766 6,501.04
6,501.04 IN
4830 22012766 6,501.04
6,501.04 IN
4830 22012766 6,501.04
6,501.04 IN
4830 22012766 6,501.04
6,501.04 IN
6457 007950 959.48
959.48 IN
6457 007951 629.44
629.44 IN
8407 08-0402 4,854.51
4,854.51 IN
10013 66723 10,495.26
10,601.28 IN
10013 66722 6,765.31
6,833.66 IN
8528 336-88353 316.13
319.02 IN
8528 336-88355 6,675.24
6,742.19 IN
9246 317992 8,162.03
751.68 IN
10090 90238549 .00
1,186.86-
8528 336-88034 313.56-
313.56- CM
What I want to do is that if the Paid Amount is not zero, set the H_Type
based on the sign of the Trans_Amount.
Is there a correct method to do this, or do I need 2 passes.
The end result will be to insert this data into an exsiting table.
Thanksk,
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical
Solutions V5R2 IBM Certified Specialist- e(logo) server i5Series
Technical Solutions Designer V5R3 IBM Certified Specialist-
e(logo)server i5Series Technical Solutions Implementer V5R3
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.