Order by last 2 characters string
Try this:
SELECT port
FROM interfaces
ORDER BY SUBSTRING_INDEX(port, '/', 1), CAST(SUBSTRING_INDEX(port, '/', -1) AS SIGNED)
Check the SQL FIDDLE DEMO
OUTPUT
| PORT |
|--------|
| Fa0/1 |
| Fa0/2 |
| Fa0/3 |
| Fa0/4 |
| Fa0/5 |
| Fa0/6 |
| Fa0/7 |
| Fa0/8 |
| Fa0/9 |
| Fa0/10 |
| Fa0/11 |
| Fa0/12 |
| Gi0/1 |
| Gi0/2 |
| Null0 |
| Vlan1 |
Why you need + 0
?? Simply remove it and it will work.
SELECT port FROM interfaces ORDER BY RIGHT(port, 2)
SQL Fiddle Demo
Output:
PORT
------------
Fa0/1
Gi0/1
Gi0/2
Fa0/2
Fa0/3
Fa0/4
Fa0/5
Fa0/6
Fa0/7
Fa0/8
Fa0/9
Fa0/10
Fa0/11
Fa0/12
Null0
Vlan1