Hi Josh,
this should match your expected output:
CASE
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)
END
Dieter
↧