I want to order one of my tables column named smsfilename which contains values like this:
| id | smsfilename |
|---|---|
| 1 | 1.1.18 Termino |
| 2 | 2 abcc |
| 3 | 1.1.1 xyz |
| 4 | 1.1.5 ship |
| 5 | 1.1.11 abc |
| 6 | 1.1.11 aa |
| 7 | 1.2 aarun |
| 8 | 1.1 arun |
| 9 | 1.1.10 vesta |
| 10 | 1.1.1 TrojanWar |
I want to sort the values like this:
| id | smsfilename |
|---|---|
| 1 | 1.1 arun |
| 2 | 1.1.1 TrojanWar |
| 3 | 1.1.1 xyz |
| 4 | 1.1.5 ship |
| 5 | 1.1.10 vesta |
| 6 | 1.1.11 aa |
| 7 | 1.1.11 abc |
| 8 | 1.1.18 Termino |
| 9 | 1.2 aarun |
| 10 | 2 abcc |
I have used this mysql query, but it does not achieve my expected result
select *
from smsproceduresfiles
order by cast('/' + replace(smsFileName , '.', '/') + '/' as UNSIGNED) ASC;