so I have a table that has the column "status" where it contains ERROR, FAILED, SUCCESS. how can I sort it but have FAILED always on the top of the result? for example, if I sort it by status asc, the result will be : FAILED ERROR SUCCESS
CodePudding user response:
You can use a case expression,
order by case when status='FAILED' then 0 else 1 end, status
CodePudding user response:
so you can set the order for each item:
ORDER BY FIND_IN_SET(status, "FAILED,SUCCESS,ERROR");