in reply to substr sort ??

I think you want substr($a, 0, 2) instead of substr($a,1)

Check out the syntax of substr here