Skip to content
Advertisement

Getting an element and the next from a table

I have a table with ids, cities and some sequence number, say:

I want to get the city that comes after Rome for the same id, in this case, I can order them by doing something like:

I get:

and, I want to get

How do I proceed?

Advertisement

Answer

Hmmm . . . I might suggest window functions:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement