Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

How to order a string as integer

From: Magnus Borg <magnus(at)troberg.se>
Date: Thu Jun 28 2007 - 11:47:00 EDT


Hello list

Got strings in the format "integer+(char)^0..1", ex 3456, 2323, 2324A, 2324B, ...

I want to order them as they where integers, like:

        order by cast(STING as unsigned) desc

But when using that query resulting in error 1292. And the result are not correct.

How can I remove the chars before i casting the string? And if possible take the chars in the order.
So that i get a result like: 1000, 1000A, 1000B, 900, 800, 800A.

//M

PS
Sorry for spelling and grammar
DS

Do you need help?X

No virus found in this outgoing message. Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.9.10/875 - Release Date: 2007-06-27 21:08  

-- 
MySQL General Mailing List
For list archives: 
http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/mysql?unsub=lists@pantek.com
Received on Thu Jun 28 13:09:26 2007

This archive was generated by hypermail 2.1.8 : Thu Jun 28 2007 - 13:10:04 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library