I know this has been discussed alot and I have read alot of the q/a to get as far as I have. I almost have it working perfect but not quite yet. The following is an example of the results I am getting and what I am needing.
CMG-1
CMG-1GP
CMG-1EN
CMG-2GP
CMG-2
CMG-2EN
CMG-3
etc...
The code I have to order by is
ORDER BY CAST( SUBSTRING( items.item_num, INSTR( items.item_num, '-' ) +1 ) AS UNSIGNED ) ASC
This works for the most part but is not properly sorting anything after the number. The prefix is different letters and different lengths so it's working fine to ignore the prefix. It's after the number that isn't sorting right. Any suggestions?