Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: cusotm sort in order by

Re: cusotm sort in order by

From: chensm <chensm_at_sesrcs1.src.se.bp.com>
Date: Tue, 3 Aug 1999 11:30:15 +0800
Message-ID: <7o5nbf$c01@eugwy1.bp.com>


try this
select * from t
order by (decode(b,'Dog',1,'Horse',2,'Snake',3,'Elephant',4,5));

Nandakumar wrote in message <7o59ns$e20$1_at_nnrp1.deja.com>...
>I like to sort the rows of a table in a custom order of a column.
>Say the table T(A,B) has values for B as
>'Snake' 'Dog', 'Horse', 'Elephant'.
>I would want the select to list the values in the order
>'Dog' 'Hosrse' 'Snake' 'Elephant'. (** Not in ASC or DESC orders)
>
>Would appreciate any help.
>--
>Nandakumar
>Systems Analyst
>New York
>(N.Kumar_at_rocketmail.com)
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Mon Aug 02 1999 - 22:30:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US