Re: Operator 'in' in a select statement

From: Brian P. Mac Lean <brian.maclean_at_teldta.com>
Date: 1996/05/25
Message-ID: <31A7C196.65C9_at_teldta.com>#1/1


Stefano Compieta wrote:
>
> Hi,
>
> I don't know how the operator 'IN' work retrieving columns in a select
> statement . For example in the following select :
>
> 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 ?
>
> Thanks ,
>
> Stefano Compieta .

col BART noprint
SELECT col1,

       decode(col1, 10, 'A',
                    20, 'B',
                    15, 'C',
                    30, 'D', '?') BART

FROM table1
WHERE col1 IN (10,20,15,30)
ORDER by BART;

I don't have a instance to test it on but the general idea should work.

brian.maclean_at_teldta.com Received on Sat May 25 1996 - 00:00:00 CEST

Original text of this message