On Tue, 2002-02-05 at 10:18, Vishakha Mali_Wagh wrote:
> Now I need to sort a field of varchar type.  But the filed values are like...
> b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12....
> meaning thereby, an integer prefixed by some character.
> Is there any straight  way to frame the query?

OK, if the prefix is always one character you could use:

SELECT ... FROM ... 
ORDER BY left(field,1), SUBSTRING(field,2)/XXXXXX

where XXXXXX is the upper limit of the integer part of the field.
I'm shure there are much better ways to do this, because this only
applies when your field has a prefix of only one character and when you
know the upper limit of the integer part of the field.

Note that if you are using MySQL 4.0.2, you don't need this because you
have the CAST() and CONVERT() functions.


-- 
Diana Soares

(sql)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to