View Single Post

   
  #2 (permalink)  
Old 05-10-2008, 02:03 PM
Rik Wasmus
 
Posts: n/a
Default Re: Order by alphanumeric

On Thu, 08 May 2008 09:21:06 +0200, Asteras Amaliadas <asteras@gmail.com>
wrote:

> Hi.
>
> I want to sort the following selection list:
>
> A1
> A10
> A5
> BA100
> BA11
> BA5
>
> alphanumerically, so that the list is first ordered by the variable
> length alphabetic prefix and then by the variable length numeric
> suffix, ie:
>
> A1
> A5
> A10
> BA5
> BA11
> BA100
>
> Any idea? Note that I cannot change the strings (ie A1 to A0001, etc).


You should be able to... If it's important 'BA' an '11' should even be in
a different column.

What will work, but will produce warnings, is REVERSE(), CAST to integer,
yet another REVERSE, get that string length, CAST the result to integer
again, and that's your number, and get the portion of the string minus the
number characters on the right you found out using the weird cast/reverse
scenario, and that's your 'BA' string.
--
Rik Wasmus
Reply With Quote