turn them back into numbers with a math function

ORDER BY ABS(value)

> -----Original Message-----
> From: Jürgen Müller [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 30, 2002 5:23 PM
> To: [EMAIL PROTECTED]
> Subject: Add: Problem with ORDER BY
> 
> 
> I've changed my query to:
> 
> $order = "SUBSTRING_INDEX(objektname,'-',1)";
> $order .=
> ",RIGHT(objektname,(LENGTH(objektname)-LOCATE('-',objektname)))";
> 
> so that the syntax ist okay, and the tests too:
> mySQL returns the correct values:
> 
> objekt   SUBSTRING_INDEX(objekt,'-',1)  LENGTH(objekt)
> LOCATE('-',objekt)  RIGHT(...)
> MD1-1234              MD1                                     8
> 4             1234
> MD1-32                MD1                                     6
> 4             32
> SD1-1                 SD1                                     5
> 4             1
> 
> But the search-results are not ordered corectly. Perhaps i 
> can transform
> the numbers int integer? I think they are stil handled as string...
> 
> Greetings,
> Jürgen
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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