Let's say, for example, I have a list of email addresses retrieved like so:
SELECT email FROM users ORDER BY email
This returns:
a@email.com
b@email.com
c@email.com
...
x@email.com
y@email.com
z@email.com
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:
x@email.com
y@email.com
z@email.com -- Note x-z is here
a@email.com
b@email.com
c@email.com
...
u@email.com
v@email.com
w@email.com
Is there a way to do this within the SQL? I'd like to not have to do it application-side for memory reasons.