Hi All,
I have column which consist of data like

AB1
AB2
AC3
AD5
AB1
AB2

When i do order by this coulumn, its not ordering properly.
It should order like
AB1
AB1
AB2
AB2
AC3
AD5

Thanks

if the format is always same, order by last character.

Hi debasis,
Thanks for reply..
The format is not same some times the data will be like

AB1A
AB2B

I think we cannot include this column in order by.
Any idea or suggestions?

Thanks

if the format is always same for position of number in the character string ?

I think you are looking for

order by left(column_name,1),substring(column_name,2,1),substring(column_name,3,1)

that will work if the format of data is consistent across.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.