* [EMAIL PROTECTED] > In order to remove the first character '0' of the field 'number', > I want to use the following sql query to select the field from my > database. > > select right(number, > if(locate('0',length(number))=1,length(number)-1,length(number))) > as 'no_zero' from mydatabase order by id desc LIMIT 0, 30
locate('0',length(number))=1 will only be true when number="". Mysql can do string to number conversions automatically: mysql> select '0123'+0; +----------+ | '0123'+0 | +----------+ | 123 | +----------+ 1 row in set (0.00 sec) -- Roger 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