MySQL Forums
Forum List  »  Newbie

Re: Sorting a column
Posted by: Felix Geerinckx
Date: April 15, 2005 02:04AM

mailtome wrote:

> SELECT col FROM foo
> ORDER BY col REGEXP "^[^0-9]", col+0, col
>
> This query works while sorting in ascending order
> While SELECT col FROM foo
> ORDER BY col REGEXP "^[^0-9]", col+0, col DESC
> doesnt works :(

The DESC in your query oly works on the last ORDER BY option. You'll have to add them to your other options too:

ORDER BY col REGEXP "^[^0-9]" DESC, col+0 DESC, col DESC

Depending on your requirements, you might even want to change the order of the options.

--
felix

Options: ReplyQuote


Subject
Written By
Posted
April 08, 2005 10:37PM
April 09, 2005 03:27AM
April 09, 2005 04:57AM
April 14, 2005 11:51PM
Re: Sorting a column
April 15, 2005 02:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.