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




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.

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.