ORDER BY FIND_IN_SET(card_type, "MASTER-CARD,VISA,DISCOVER") -- sort 'MASTER-CARD' first.
ORDER BY x IS NULL, x -- order by `x`, but put `NULLs` last.
Custom ordering
SELECT * FROM some_table WHERE id IN (118, 17, 113, 23, 72)
ORDER BY FIELD(id, 118, 17, 113, 23, 72);
Returns the result in the specified order of ids.
| id | ... |
|---|---|
| 118 | ... |
| 17 | ... |
| 113 | ... |
| 23 | ... |
| 72 | ... |
Useful if the ids are already sorted and you just need to retrieve the rows.