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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to display the return this way?

Re: How to display the return this way?

From: Dmitry E. Loginov <dmitry_loginov_at_mtu.ru>
Date: Fri, 14 Dec 2001 20:34:42 +0300
Message-ID: <9vdd6j$1j07$1@gavrilo.mtu.ru>


Just use decode in the order by clause.

Select A, B
 from myTable

 where A = 'A1'
 or A = 'D1'
 or A = 'C1'
 or A = 'B1'

order by decode(A,'A1',1 , 'D1',2, 'C1' ,3, 'B1',4,5);

"C Chang" <cschang_at_maxinter.net> wrote in message news:3C1A1F19.1421_at_maxinter.net...
> I have a select script such as:
>
> Select A, B
> from myTable
> where A = 'A1'
> or A = 'D1'
> or A = 'C1'
> or A = 'B1'

order by decode(A,'A1',1 , 'D1',2, 'C1' ,3, 'B1',4,5) ;
>
> How do I let my return display as my order in where clause:
>
> A1 Bxx
> D1 BXXX
> C1 BX
> B1 Byy
>
> but not in sorted order of column A -> A1, B1, C1, D1.
>
> C Chang
Received on Fri Dec 14 2001 - 11:34:42 CST

Original text of this message

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