Использование сопутствующих суб-выборов может помочь вашему исполнению.
WITH D_PRODUCT ( PNUM , EFFECTIVE_DATE , STAGE , ORG_ID , CURRENT_FLAG ) AS (VALUES
('2A1245' , '1999-10-01' , 07 , 'W6' , 'N')
,('2A1245' , '2006-01-01' , 07 , 'U4' , 'N')
,('2A1245' , '2007-11-21' , 07 , 'U4' , 'N')
,('2A1245' , '2008-03-23' , 07 , 'KF' , 'N')
,('2A1245' , '2008-11-23' , 07 , 'KF' , 'N')
,('2A1245' , '2009-02-25' , 07 , 'KF' , 'N')
,('2A1245' , '2015-03-19' , 07 , 'U5' , 'N')
,('2A1245' , '2015-04-14' , 07 , 'U6' , 'N')
,('2A1245' , '2015-04-17' , 07 , 'U6' , 'N')
,('2A1245' , '2015-05-01' , 07 , 'U6' , 'N')
,('2A1245' , '2017-09-26' , 08 , '8X' , 'N')
,('2A1245' , '2019-02-20' , 08 , '8X' , 'N')
,('2A1245' , '2019-03-18' , 08 , '8X' , 'N')
,('2A1245' , '2019-04-24' , 08 , '8X' , 'N')
,('2A1245' , '2019-04-29' , 08 , '8X' , 'N')
,('2A1245' , '2019-05-11' , 08 , '8X' , 'N')
,('2A1245' , '2019-05-15' , 08 , '8X' , 'N')
,('2A1245' , '2019-06-05' , 08 , '1Z' , 'N')
,('2A1245' , '2019-06-08' , 09 , 'W1E' , 'N')
,('2A1245' , '2019-06-11' , 09 , 'W1E' , 'N')
,('2A1245' , '2019-08-19' , 09 , 'EBI' , 'N')
,('2A1245' , '2019-09-03' , 09 , 'EBI' , 'Y')
)
SELECT
PNUM
, STAGE
, (SELECT MIN(EFFECTIVE_DATE) FROM D_PRODUCT M WHERE m.PNUM = a.PNUM) AS EFFECTIVE_DATE
, (SELECT MIN(EFFECTIVE_DATE) FROM D_PRODUCT C WHERE c.PNUM = a.PNUM AND c.STAGE = a.STAGE ) AS STAGE_CHANGE
FROM D_PRODUCT a
WHERE
CURRENT_FLAG = 'Y'
Возвращает
PNUM STAGE EFFECTIVE_DATE STAGE_CHANGE
------ ----- -------------- ------------
2A1245 9 1999-10-01 2019-06-08