Skip to Content
0
Former Member
Feb 05, 2014 at 12:39 AM

SQL Expression case

42 Views

I have to fetch some data this way because all links are failing. How do I specify that i want to also select the second table, the ICDET76PK. THIs one is not working on the first =. The thing is I want this to be distinct on the ICDET76PK.ITTRN#

because, the testpk1 is a summary table and the other is detail, if there are more than 1 detail records for part# and invoice then we don't want to fetch twice. we basically want to fetch the invoice amt for the part, this is summarized and correct.

(

SELECT

PKLIB.TESTPK1.LINTOT01,

FROM

PKLIB.TESTPK1

WHERE

PKLIB.TESTPK1.IDINV# = PKLIB.ICDET76PK.ITTRN#

AND PKLIB.TESTPK1.IDPRT# =

PKLIB.ICDET76PK.ITPRT#

)