Hi Dieter,
I finally figured out how to achive this using SET logic with UNBOUNDED option. RECURCIVE query si too expensive because the table which the select reads from is large. And as you mentione dprocedure also is expensive because of size of table.
, MIN(A.Entry_Date ) OVER (PARTITION BY A.Customer ORDER BY A.Entry_Date DESC RESET WHEN ( From = To OR Action = 'WENT-LST') ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS Entry_Date_START_ACT
, MIN(A.Entry_Date ) OVER (PARTITION BY A.Customer ORDER BY A.Entry_Date DESC RESET WHEN Action = 'WENT-LST' ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS Entry_Date_START
, CASE WHEN (Action <> 'WENT-LST')
AND (Entry_Date_START_ACT <= Entry_Date )
AND Entry_Date_CARRIER_START = Entry_Date _CARRIER_START_ACT
THEN 'Y' ELSE 'N'
Thanks,
Abin.
Hi Dieter,
I finally figured out how to achive this using SET logic with UNBOUNDED option. RECURCIVE query si too expensive because the table which the select reads from is large. And as you mentione dprocedure also is expensive because of size of table.
Thanks,
Abin.