Oracle custom sort
- by Carter
The query...
select distinct name from myTable
returns a bunch of values that start with the following character sequences...
ADL*
FG*
FH*
LAS*
TWUP*
Where '*' is the remainder of the string.
I want to do an order by that sorts in the following manner...
ADL*
LAS*
TWUP*
FG*
FH*
But then I also want to sort within each name in the standard order by fashion. So, an example, if I have the following values
LAS-21A
TWUP-1
FG999
FH3
ADL99999
ADL88888
ADL77777
LAS2
I want it to be sorted like this...
ADL77777
ADL88888
ADL99999
LAS2
TWUP-1
FG999
FH3
I initially thought I could accomplish this vias doing an order by decode(blah) with some like trickery inside of the decode but I've been unable to accomplish it. Any insights?