Re: An order by question

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tomasz Myrta <jasiek(at)klaster(dot)net>
Cc: darnold(at)northcoast(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: An order by question
Date: 2004-02-01 19:11:12
Message-ID: 20040201121112.C18549@quality.qadas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, Feb 01, 2004 at 06:22:30PM +0100, Tomasz Myrta wrote:
> Dnia 2004-02-01 14:34, U¿ytkownik Michael Fuhr napisa³:
> > SELECT *
> > FROM records
> > ORDER BY lastName,
> > firstName,
> > SUBSTRING(term FROM 1 FOR 4),
> > CASE SUBSTRING(term FROM 5)
> > WHEN 'S' THEN 1
> > WHEN 'X' THEN 2
> > ELSE 3
> > END;
>
> or the easier one:
>
> order by lastname,firstname, translate(term,'SXF','123');

Blast...I just *knew* I was missing an easy, obvious solution.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tomasz Myrta 2004-02-01 19:43:34 Re: Executing dynamic queries (EXECUTE)
Previous Message Tomasz Myrta 2004-02-01 17:22:30 Re: An order by question