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: Qurey question

Re: Qurey question

From: Jim Lyons <jlyons_at_weblyons.com>
Date: 16 Oct 2001 15:09:17 -0700
Message-ID: <e67857c9.0110161409.3b9ce81b@posting.google.com>


"Jack Simmions" <laclac01_at_yahoo.com> wrote in message news:<3bcc6406_3_at_corp-news.newsgroups.com>...
> In a query if I want to order my departments by a department number in order
> of 10, 30, 20 how would I go about attempting this? Can this be done with
> one command?
> thanks

If those are the only values you have to deal with, you could write a query based on the following:

select decode(deptno, 10, 1, decode(deptno, 30, 2, 3)), deptno from test order by 1;

Obviously, the more dept numbers you have the more cumbersome this becomes. If it gets to be too many, you might consider setting up a separate table with the dept number, sort order relationship and do a join.

Jim Lyons
UT Austin Received on Tue Oct 16 2001 - 17:09:17 CDT

Original text of this message

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