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 -> simple SQL query question

simple SQL query question

From: <jimi_xyz_at_hotmail.com>
Date: 7 Dec 2005 10:52:00 -0800
Message-ID: <1133981520.377310.152540@z14g2000cwz.googlegroups.com>


Hi,
Ok I have this simple query..

SELECT id, name
FROM people
where id in (176, 181, 22, 61);

which returns..

id                                                 name

---------------------------------------------------------------------
22 John 61 Sam 176 Tom 181 Pam

What I want is for the query to return the "names" and "ids" in the order of the in() clause.
Since my in() clause looks like this, in (176, 181, 22, 61). I want my results to look like this..

id                                                 name

---------------------------------------------------------------------
176 Tom 181 Pam 22 John 61 Sam

As you can see they are in the order of the IN() clause, (176, 181, 22, 61). I am not to sure on how I could do this, one of my friends told me to use decode, so i have been messing around with that all day today. Any help or ideas will be appreciated.

Thanks,
-Jimmie Received on Wed Dec 07 2005 - 12:52:00 CST

Original text of this message

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