I have a table, I want to display one previous record
select id_1
, lag(kd_1) over(order by kd_1) as ID_PREV
, kd_1
, dt_change
, id_usr
from t1.status_hist
where kd_sys_1 = 6
order by id_sys_1
1 19 19 2020-12-01 14:35:40 id_usr
1 18 18 2020-12-01 14:35:49 id_usr
2 19 19 2020-12-01 14:35:50 id_usr
3 18 18 2020-12-01 14:38:14 id_usr
3 19 19 2020-12-01 14:37:27 id_usr
4 19 19 2020-12-01 14:37:54 id_usr
4 18 2020-12-01 14:38:14 id_usr
But I only need one entry and what would happen something like this
1 18 19 2020-12-01 14:35:40 id_usr
2 19 19 2020-12-01 14:35:50 id_usr
3 18 19 2020-12-01 14:37:27 id_usr
only the previous entry