Re: Operator 'in' in a select statement

From: Steve Corbett <scorbett_at_perth.DIALix.oz.au>
Date: 1996/05/31
Message-ID: <4olfsf$obd$1_at_perth.DIALix.oz.au>#1/1


Dirk Schmidtpott (Dirk.Schmidtpott_at_t-online.de) wrote:
: scomp_at_mbox.vot.it (Stefano Compieta) wrote:
: > SELECT col1 FROM table1 WHERE col1 IN (10,20,15,30)
: >columns are displayed
: > col1
: > --------
: > 30
: > 15
: > 20
: > 10
 

: >order is different to the order I write in the select statement .
: >How I can do if I want to retrieve columns in the order I write them ?
:
: an index to them. By the way, this is true for any select. If you add
: an order by clause to your example, you will still not get the rows in
: your requested order, because they are ordered numerical. The solution
: is to add a column to the table, which contains the order level for
: the other column.

you could try:
select col1 from table1
 where col1 in (10,20,15,30)
 order by decode(col1,10,1,20,2,15,3,30,4,5);

heLp?

-- 
                                          vvv
steve corbett                           [ . .]
                                           |
scorbett_at_perth.dialix.oz.au     _____oOO_______OOo_____
Received on Fri May 31 1996 - 00:00:00 CEST

Original text of this message