Say I have a dropdown buttons of credit cards.
My ordering is:
SELECT * from cards;
DISCOVER
MASTER-CARD
VISA
I actually want
MASTER-CARD
VISA
DISCOVER
This is a custom order decided by business.
So I though of maintaining a sequence_id in Mysql
DISCOVER 3
MASTER-CARD 1
VISA 2
So I can get these fields in order of their sequence_id.
SELECT * from cards order by sequence_id;
MASTER-CARD 1
VISA 2
DISCOVER 3
But the problem is when I have to add another card in the table, I will have to custom update all ids. Is there a better way to maintain sequence?
How to define a custom ORDER BY order in mySQL does not solve my problem as I can't specify all the fields in my query as the table is huge and keeps changing.