I am a new coder, and I am trying to figure out how to sort a field that may contain both letters and numbers, and have it appear in the correct numerical order.
The current sort syntax I have been using is:
ORDER BY CAST(minis.number AS UNSIGNED), minis.number
This has worked fine for this data:
However, now I have data with text in the prefix:
The above will sort as:
I do not want it to appear in this order – I want it to appear in the order above it.
Could someone please recommend a method of sorting that will work regardless of whether text is a prefix or a suffix.