Basically I have a field that can contain some prefixed strings:
word1
bla2
ttt3
word4
[...]
I need to order SQL with for example ttt3 first and then all other string after.
I tried this with no luck
ORDER BY FIELD (myField,'ttt3',*)
Any suggestions?
Use an
ORDER BY CASEconstruct. It forces a 0 for the value you want to extract, and 1 for everything else, so the 0 sorts first. It just fits into theORDER BYlist like any column, comma-separated, so you can add additional sort columns afterward.