Did you try SQRT(id)? Should rank things the way you want if it's legal (*_*)
-----Original Message----- From: David Mackay [mailto:[EMAIL PROTECTED]] Sent: Monday, February 11, 2002 7:08 PM To: 'David Turner'; David Mackay Cc: '[EMAIL PROTECTED]' Subject: RE: ORDER BY an ABSolute value Thanks for your quick response Dave, Have tried this, but no bannana... I get: "You have an error in your SQL syntax near 'abs(id)' at line 1" Seems a not-valid thing to do these days... Is there a work around? Dave from Oz > select id from table_name order by abs(id); > > Dave > > > Dundee! > > > On Tue, Feb 12, 2002 at 09:46:25AM +1000, David Mackay wrote: > > G'Day folks, > > > > > > New to PHP/MySQL. > > > > Want to order the results of a SELECT by their 'absolute' > value, not their > > sign. > > So regardless of whether it's +37 or -37, they are both 37 > and thus both > > come between 38 & 36, regardless of whether they're + or -. > > eg. > > 100 > > -99 > > -92 > > 91 > > 72 > > -38 > > 37 > > -37 > > etc... > > > > I have the order DESC but it puts 100 first, and -100 last, > > (that's what you'd usually want, but > > I need the extremes grouped at one end, > > down to the middle point zero......). > > > > In my fantasy world I could do a ORDER BY ABS(number) DESC > > If there was any other way to achieve the same result that > would be just > > dandy... > > > > I bet this is obvious. > > > > > > Thanks for your time, > > > > David Mackay > > > > > --------------------------------------------------------------------- > > 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 --------------------------------------------------------------------- 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