This could be a very basic problem, but I sort of don’t know SQL at all.
To simplify the problem, let there be a table with only one column, so I can write down the rows horizontally:
1 3 11 39 41 45 52 63 66 70 72 80 81 90 92 97
As you can see, they are sorted. Now, I know there is the row with "70", and I want to query five rows before it in ascending order. That is, I want
41 45 52 63 66
How should I do the query?
I can query the five rows in descending order and reverse the result set afterwards, but I think there should be a better way.
Taking likeToCode’s example, just modify it as follows, to reorder the result: