Re: Q: SQL output order by keys possible?

From: Dave Mausner <dmausner_at_brauntech.com>
Date: 1996/10/09
Message-ID: <53ffid$14g_002_at_dmausner.brauntech.com>#1/1


In article <f91-gal.844803653_at_nada.kth.se>, f91-gal_at_nada.kth.se (Göran Alterland) wrote:
>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 the value of DEPT into integers that sort the way you want:

order by decode(DEPT, 'PR',1, 'AB',2, 'QR',3, 'GH',4, 99), EMP, ...

you're welcome!

--
Dave Mausner, Consulting Manager, Braun Technology Group, Chicago.
Received on Wed Oct 09 1996 - 00:00:00 CEST

Original text of this message