this should match your expected output:
WHEN status =200 THEN -1
ELSE MIN(CASE WHEN status =200 THEN CAST(status_date AS DATE) END)
OVER (PARTITION BY vin_r
ORDER BY status_date
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) - CAST(status_date AS DATE)
Thanks Lot Dnoeth,
I am really happy ....no words to express my Sincere thanks to your great help...
In the above query Is working fine. Once again my thanks to your effort...
Thanks & Regards