Skip to content
Advertisement

Sorting a table result based on a column but without it’s natural ordering?

I want to order the employees based on their designation; i.e Not the natural order of the job_name (Alphabetical) but in the following order

President -> Manager -> Clerk -> Salesman.

I was thinking of creating a view of job_name an priority and then using that to sort the table.

Is there any way to do it without using any other view for the same?

Employee sample table

Advertisement

Answer

You can use a case statement for that:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement