Skip to Content
0
Former Member
Dec 05, 2008 at 10:59 AM

Help with select statement

18 Views

Hi experts,

I need help with a select statement....

I want to select a fixed period(FIXPER) from table TIVCDFIXPERDATE(Date of Fixed Period) based on certain values I receive from a file. For example, If I have receive the following values in the file;

For period 1

FIXPERNO = 1

FIXPERDAY = 28

FIXPERMONTH = 2

For period 2

FIXPERNO = 2

FIXPERDAY = 28

FIXPERMONTH = 2

I'm currently using a select subquery as shown below but I'm not getting the correct FIXPER back;

SELECT SINGLE fixper

FROM tivcdfixperdate

INTO lv_fixper

WHERE fixperno = '1'

AND fixpermonth = ls_prd1-mm

AND fixperday = ls_prd1-dd

AND EXISTS ( SELECT fixper

FROM tivcdfixperdate

WHERE fixperno = '2'

AND fixpermonth = ls_prd2-mm

AND fixperday = ls_prd2-dd ).

Thanks in advance,

C