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: Returning results in the order they were entered

Re: Returning results in the order they were entered

From: Matthias Wirtz <Matthias.Wirtz_at_epost.de>
Date: Tue, 11 Nov 2003 21:24:51 -0500
Message-ID: <bos70p$1iak9c$1@ID-151394.news.uni-berlin.de>


"Niall Litchfield" <n-litchfield_at_audit-commission.gov.uk> schrieb im Newsbeitrag news:3fabab68$0$261$ed9e5944_at_reading.news.pipex.net...

> > select distinct id,name from Caseflow.cases where number1 in
> > (124125,124122,124130);

> As others have said you need to define what you mean by 'order they were
> entered by the user', but you seem to mean
> in the order that appears in the in clause...

You can achive this with the disadvantage of an overhead. Use the UNION clause and split up the IN clause like this:

SELECT DISTINCT id, name, 1 idx from Caseflow.cases where number1 = 124125 UNION
SELECT DISTINCT id, name, 2 idx from Caseflow.cases where number1 = 124122 UNION
SELECT DISTINCT id, name, 3 idx from Caseflow.cases where number1 = 124130 ...
ORDER BY idx;

--
Matthias Wirtz  -  Norfolk, USA
Received on Tue Nov 11 2003 - 20:24:51 CST

Original text of this message

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