My query looks like this:
SELECT A.COMPANY, SUM( B.EARNINGS)
FROM PS_PAY_LN A, PS_PAY_OTHERS B
WHERE B.COMPANY = A.COMPANY
AND B.PAY_END_DT = A.PAY_END_DT
AND B.LINE_NUM = A.LINE_NUM
AND ( A.COMPANY = :1
AND A.PAY_END_DT BETWEEN :2 AND :3
AND B.ERNCD IN ('A','D','X') )
GROUP BY A.COMPANY
Instead of hard-coding the B.ERNCD IN ('A','D','X') , how can it be worked out in a prompt? There is a table (call it Table_C) which may be use for this purpose but I don't how. Table_C has the following records (for example):
fldName ERNCD
F01 A
F01 D
F01 X
F02 C
F02 E
F03 F
F03 G
F03 I
Any suggestion is greatly appreciated.
SELECT A.COMPANY, SUM( B.EARNINGS)
FROM PS_PAY_LN A, PS_PAY_OTHERS B
WHERE B.COMPANY = A.COMPANY
AND B.PAY_END_DT = A.PAY_END_DT
AND B.LINE_NUM = A.LINE_NUM
AND ( A.COMPANY = :1
AND A.PAY_END_DT BETWEEN :2 AND :3
AND B.ERNCD IN ('A','D','X') )
GROUP BY A.COMPANY
Instead of hard-coding the B.ERNCD IN ('A','D','X') , how can it be worked out in a prompt? There is a table (call it Table_C) which may be use for this purpose but I don't how. Table_C has the following records (for example):
fldName ERNCD
F01 A
F01 D
F01 X
F02 C
F02 E
F03 F
F03 G
F03 I
Any suggestion is greatly appreciated.