sorting varchar field which include numbers

`

SELECT id, SUBSTRING_INDEX(name, '-', 1),marks, SUBSTRING_INDEX(name, '-', -1) as code_value ?FROM test ORDER BY code_value

`

Leave a Reply

Your email address will not be published. Required fields are marked *