Reputation: 47
I have data in a table and need to populate the min and max range for the row number column.
This is my input table:
I would like to have the following output table result without using a cursor:
Upvotes: 0
Views: 49
Reputation: 1269633
Do you just want lag()
?
select t.*,
lag(rownumber, 1, 0) over (order by rownumber) as rownumber_min,
rownumber as rownumber_max
from t;
Upvotes: 3