Order by last 2 characters string

Viewed 9281

This is the result of my query, but it doesn't order correctly. I want to order by the last 2 characters. The result should be: Fa0/10 below Fa0/9.

Fa0/1
Fa0/10
Fa0/11
Fa0/12
Fa0/2
Fa0/3
Fa0/4
Fa0/5
Fa0/6
Fa0/7
Fa0/8
Fa0/9
Gi0/1
Gi0/2
Null0
Vlan1

My query:

SELECT inft.port FROM interfaces AS intf ORDER BY RIGHT(intf.port + 0, 2)

Second: sqlfiddle

4 Answers
Related