I figured it out.
select
row_begin_dt,
c_ams_clm,
c_clm,
c_sta_clm,
-- Find the c_sta_clm of the previous row
max(c_sta_clm) over (partition by c_clm order by row_begin_dt rows between 1 preceding and 1 preceding) as prev_c_sta_clm
from pearl_p.TLTC900_CLM_PRSST
-- Include only records which have a c_sta_clm different to that of the previous row
qualify c_sta_clm <> prev_c_sta_clm
↧