Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 2883A475E9C for ; Tue, 14 May 2002 08:11:20 -0400 (EDT) Received: from druid.net (druid.net [216.126.72.98]) by postgresql.org (Postfix) with ESMTP id CD97A47609F for ; Tue, 14 May 2002 08:06:59 -0400 (EDT) Received: by druid.net (Postfix, from userid 1000) id DE3E91C5D; Tue, 14 May 2002 08:07:05 -0400 (EDT) Content-Type: text/plain; charset="iso-8859-1" From: "D'Arcy J.M. Cain" To: Mathieu Arnold Subject: Re: order by Date: Tue, 14 May 2002 08:07:05 -0400 X-Mailer: KMail [version 1.3.2] References: <1713675304.1021384181@andromede.reaumur.absolight.net> In-Reply-To: <1713675304.1021384181@andromede.reaumur.absolight.net> Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <20020514120705.DE3E91C5D@druid.net> X-Archive-Number: 200205/133 X-Sequence-Number: 7769 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 | 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.