Re: Q: SQL output order by keys possible?

From: Olli Rinne <otr_at_hemuli.tte.vtt.fi>
Date: 1996/10/09
Message-ID: <wiohicimz9.fsf_at_titi-uu.tte.vtt.fi>#1/1


f91-gal_at_nada.kth.se (Göran Alterland) writes:
> But what what I'd really like to do is to output a given department
> first, something along the lines of
> select EMP,SALAR from ALL_EMPS
> where SALAR <= 10000
> order by DEPT where DEPT like 'PR' first

Decode-function in order by -clause is very useful. Here's a one way to do it:

 select EMP,SALAR from ALL_EMPS
 where SALAR <= 10000
 order by decode(DEPT,'PR','A','B'), DEPT

                                                olli R Received on Wed Oct 09 1996 - 00:00:00 CEST

Original text of this message