Problem:
A row in my_table contains
1
2
3
3
4
4
4
I want to rearrange the row order to the following
4
4
4
1
3
3
2
Is there any way I can perform this?
I have not written any code so far. ( I do not know how to begin)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just use
CASEin theORDER BY– it’s much cleaner and easier to read.It’s also a bad idea to change the order of the rows since there is actually no inherent order in SQL – it’s all in the presentation layer, so use
ORDER BYin yourSELECTs to accomplish it.