The behavior of LAST_VALUE with PARTITION BY and ORDER BY can be confusing when the window frame affects which row is considered the last value. I’ve found that checking the window frame definition carefully helps make these results easier to underst...