Re: An order by question - Mailing list pgsql-sql

From Tomasz Myrta
Subject Re: An order by question
Date
Msg-id 401D35D6.2020902@klaster.net
Whole thread Raw
In response to Re: An order by question  (Michael Fuhr <mike@fuhr.org>)
Responses Re: An order by question
List pgsql-sql
Dnia 2004-02-01 14:34, Użytkownik Michael Fuhr napisał:
> Consider storing the session in a separate field and assigning each
> session a value that collates in the order you want.
> 
> Here's a way to order the sessions using their current format:
> 
> 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');

Regards,
Tomasz Myrta



pgsql-sql by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: An order by question
Next
From: lawyerkill@aol.com (LawyerKill)
Date:
Subject: REPLACE