Sagar C Nannapaneni wrote:
> ASS1
> ASS23
> ASS4
> ASS10
> ASS6
> .
> .
>
> when i'm retrieving the data by taking ORDER BY clause it is sorting like this
>
> ASS1
> ASS10
> ASS23
> ASS4
> ASS6
>
> means its only sorting by the 4 the character.
No, it's not sorted by the first four characters but it's sorted
lexicographically (string-like).
The following might help, but will certainly be quite slow:
SELECT ... ORDER BY ABS(SUBSTRING(field, 4));
A better (and faster) solution will probably be indexing the records
with a numeric field, as usual.
Greetz
Fred