I need help with the LAST_VALUE using a partition. I am trying to get a disposition date for each row, where the disposition date is the following end date (by COL1 and COL3). If there is not a following end date then NULL. My issue is the results are returning extra rows where the end date and disposition date are the same. What am I missing? Thank you!
SELECT COL1, COL2, COL3, END_DT,
LAST_VALUE(END_DT) OVER(PARTITION BY COL1, COL3 ORDER BY COL3, END_DT ASC ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) DISP_DT
Results (rows with strikethrough I don't want to see):