From: Gerhard Dieringer <DieringG@eba-haus.de>
To: ian@blazingcactus.com
To: pgsql-sql@postgresql.org
Subject: Antw: ORDER BY using specifc values
Date: Thu, 13 Apr 2000 08:32:59 +0200
Message-ID: <s8f5865a.009@kopo001> (raw)
Ian McWilton wrote:
> ...
>
> INDEX | VALUE
> 1, A
> 2, B
> 3, B
> 4, C
> 5, B
>
> ...and what I want is for my queries result to be
> ordered by VALUE with C put first in the list, then A,
> then B.
>
> Having investigated it appears that ORDER BY does not
> seem to be any help as it restricts the ordering to ASC
> or DESC.
> ...
I'm not sure, if I understood yor problem, but could the following be a solution:
create table sort_table (sf int, value char(1));
insert into sort_table(1,'C');
insert into sort_table(2,'A');
insert into sort_table(3,'B');
select y.INDEX, y.VALUE, s.sf
from your_table y, sort_table s
where y.value = s.value
order by s.sf;
------------
Gerhard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: DieringG@eba-haus.de, ian@blazingcactus.com
Subject: Re: ORDER BY using specifc values
In-Reply-To: <s8f5865a.009@kopo001>
References: <s8f5865a.009@kopo001>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox