Let’s say I want to retrieve 100 records from a table called messages, and I want to obtain them the following way:
1st message
100th message
2nd message
99th message
3rd message
98th message
(...)
Is there any way to do this efficiently? What would be the appropriate query?
Or should I make a query to select the first 50, a query to select the last 50 and then merge the results?
Try if your ID is a sequence of numbers:
First
Then