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 -> Re: SQL Order

Re: SQL Order

From: Lucas <Lucas_44_at_hotmail.com>
Date: Mon, 16 Sep 2002 19:09:15 GMT
Message-ID: <v%ph9.5$EA.6227@news0.telusplanet.net>


Tanks, this works for me.....

"Sybrand Bakker" <gooiditweg_at_sybrandb.demon.nl> wrote in message news:248cou08niv2ev5g2i3l8bl6uga0q4jaa8_at_4ax.com...
> On Mon, 16 Sep 2002 17:23:16 GMT, "Lucas" <Lucas_44_at_hotmail.com>
> wrote:
>
> >Hi all,
> >
> >I want my query result to be in the same order as my codes that I set:
> >
> >Ex:
> >
> >select * from
> >Emp
> >where empcode in (810,974,603,648)
> >
> >The result is not at all in this order? Any suggestions on why? Or is
there
> >a better way of doing this?
> >
> >
> >Lucas
> >
> >
> We're talking about relational databases and about sets here. Sets are
> by definition unordered.
> The solution would be to
> select decode(empcode,810,1,974,2,603,2,648,3,null) sortorder, *
> from emp
> where empcode in (810,974,603,648)
> order by sortorder
>
>
> Hth
>
>
> Sybrand Bakker, Senior Oracle DBA
>
> To reply remove -verwijderdit from my e-mail address
Received on Mon Sep 16 2002 - 14:09:15 CDT

Original text of this message

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