Solution not working for me
query used:
CREATE TABLE IMART_PREP.TST (STRT_DT DATE , END_DT DATE, ID INT , SALARY INT );
INSERT INTO IMART_PREP.TST VALUES ( '2018-01-01' , '2018-01-31' ,1, 1000);
INSERT INTO IMART_PREP.TST VALUES ( '2018-02-01' , '2018-02-28' , 1, 2000);
INSERT INTO IMART_PREP.TST VALUES ( '2018-03-01' , '2018-03-30' , 1, 3000);
INSERT INTO IMART_PREP.TST VALUES ( '2018-04-01' , '2018-04-30' , 1, 4000);
SELECT * FROM IMART_PREP.TST;
CREATE TABLE IMART_PREP.TST_1 (STRT_DT DATE , END_DT DATE, ID INT , SALARY INT );
INSERT INTO IMART_PREP.TST_1 VALUES ( '2018-01-01' , '2018-01-31', 1, 1000);
SELECT *
FROM IMART_PREP.TST A , IMART_PREP.TST_1 B
WHERE ( (A.ID = B.ID ) AND (A.STRT_DT BETWEEN B.STRT_DT AND B.END_DT ) ) OR (B.STRT_DT IS NULL );