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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to