0

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:

enter image description here

I would like to have the following output table result without using a cursor:

enter image description here

1 Answer 1

3

Do you just want lag()?

select t.*,
       lag(rownumber, 1, 0) over (order by rownumber) as rownumber_min,
       rownumber as rownumber_max
from t;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.