Order By Comma List MySQL, Kommalisten in Listenreihenfolge zurueckgeben
You can have your sql query return the records with order by “a list of commaseparated values” which is very handy if you have do deal with lists of records stored as lists of ids. sorting in typo3 would be an example.
SELECT col1, col2, col3
FROM table1
WHERE col1 IN ('z', 'x', 'y')
ORDER BY find_in_set(col1, 'z,x,y');