Answers for "how to get previous row value in postgresql"

SQL
0

select value from previous row in postgresql

-- use LAG(column_name, lag) OVER (PARTITION BY x ORDER BY y)
select
	id,
	version,
	start_date,
	lag(dss_end_date, 1) over (partition by id order by version) as previous_row_end_date
	end_date
from
	table
order by
	id,
	version;
Posted by: Guest on August-10-2021

Code answers related to "how to get previous row value in postgresql"

Code answers related to "SQL"

Browse Popular Code Answers by Language