2

I have a result set like this: a b c

This result will be fixed each time. What I need to do is order the rows like this a c b. How can I do that ?

1

1 Answer 1

4
SELECT  value
FROM    mytable
ORDER BY
        CASE value WHEN 'a' THEN 1 WHEN 'c' THEN 2 WHEN 'b' THEN 3 END
Sign up to request clarification or add additional context in comments.

1 Comment

Or... order by some_immutable_function(value)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.