It is not uncommon to have a sort column, for alternative ways to sort data. Recently a client requested a GUI to change sort order of how “data” is returned to their end user.
Using my new found knowledge of “FIND\_IN_SET” which I spoke about in the Sort by specific ID, I quickly whipped up a HTML/Javascript GUI that allows users to move items up and down in a select list…
When they are happy they can submit… and sortorder column reflects how they feel data should be ordered.
Here is the SQL code that is run … where “1,2,3, ....” is the order that user wants.
UPDATE TABLE tablename
SET sortordercol = FIND\_IN_SET(id, "1,2, 3...")