Let's say, for example, I have a list of email addresses retrieved like so:
SELECT email FROM users ORDER BY email
This returns:
[email protected]
[email protected]
[email protected]
...
[email protected]
[email protected]
[email protected]
I'd like to take this result set, slice the bottom 3 emails and move them to the top, so you'd see a result set like:
[email protected]
[email protected]
[email protected] -- Note x-z is here
[email protected]
[email protected]
[email protected]
...
[email protected]
[email protected]
[email protected]
Is there a way to do this within the SQL? I'd like to not have to do it application-side for memory reasons.