pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: D'Arcy J.M. Cain <darcy@druid.net>
To: Mathieu Arnold <mat@mat.cc>
Cc: pgsql-sql@postgresql.org
Subject: Re: order by <something wierd>
Date: Tue, 14 May 2002 08:07:05 -0400
Message-ID: <20020514120705.DE3E91C5D@druid.net> (raw)
In-Reply-To: <1713675304.1021384181@andromede.reaumur.absolight.net>
References: <1713675304.1021384181@andromede.reaumur.absolight.net>

On May 14, 2002 07:49 am, Mathieu Arnold wrote:
> table a (int, varchar, int)
>
> 1 | one   | 1
> 2 | two   | 3
> 3 | three | 2
> 4 | four  | 3
> 5 | five  | 2
>
> And I would like to select it and sort it so that the 3rd field is first 2,
> then 1 and then 3. so that the result should be :
>
> 1 | one   | 1
> 3 | three | 2
> 5 | five  | 2
> 2 | two   | 3
> 4 | four  | 3
>
> How could I do that ?

If I understand what you are asking:

SELECT c3, c2, c1 FROM a ORDER BY c3, c1;

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



view thread (8+ messages)  latest in thread

Message-ID: <20020514120705.DE3E91C5D@druid.net>
Permalink:  ../20020514120705.DE3E91C5D@druid.net/
Also on:    postgresql.org/message-id/20020514120705.DE3E91C5D@druid.net

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: darcy@druid.net, mat@mat.cc
  Subject: Re: order by <something wierd>
  In-Reply-To: <20020514120705.DE3E91C5D@druid.net>

* 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