Sorting Part of a Field

Use the following code:

 select *,right(field1,4) as Col1 from [Tablename]order by col1

You can do it by using substring:

 SELECT *, substring(field1, 3, 5) as col1from [tablename]order by col1
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: