likely better to use a decode in the where clause
select
id
, name
from Caseflow.cases
where number1 in (124125,124122,124130)
order by decode( number1
124125, 1
,124122, 2
,124130, 3
)
-- mcs
"Matthias Wirtz" <Matthias.Wirtz_at_epost.de> wrote in message
news:bos70p$1iak9c$1_at_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 Wed Nov 12 2003 - 06:10:09 CST