Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 74A8D47616E for ; Tue, 14 May 2002 08:30:54 -0400 (EDT) Received: from aragorn.reaumur.absolight.net (ATuileries-113-2-1-180.abo.wanadoo.fr [80.11.216.180]) by postgresql.org (Postfix) with ESMTP id 16176475FF4 for ; Tue, 14 May 2002 08:27:06 -0400 (EDT) Received: from andromede.reaumur.absolight.net (andromede.reaumur.absolight.net [212.43.217.61]) by aragorn.reaumur.absolight.net (Postfix) with ESMTP id D9483D70E; Tue, 14 May 2002 14:27:07 +0200 (CEST) Date: Tue, 14 May 2002 14:28:57 +0200 From: Mathieu Arnold To: Joel Burton , pgsql-sql@postgresql.org Subject: Re: order by Message-ID: <1716030471.1021386536@andromede.reaumur.absolight.net> In-Reply-To: References: X-Mailer: Mulberry/2.2.1 (Win32) X-wazaaa: True, true MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Archive-Number: 200205/136 X-Sequence-Number: 7772 --On mardi 14 mai 2002 08:05 -0400 Joel Burton wrote: > You're asking to have it be sorted as {2,1,3}, but the sample result data > you give seems to sort by {1,2,3}. Or am I misunderstanding your question? you're right, I messed up my example :) I'll buy the second solution, it's the easier to put on. > 2) inlined in sql > > SELECT * FROM a > ORDER BY CASE WHEN col3=2 THEN 1 > WHEN col3=1 THEN 2 > ELSE 3 > END; -- Mathieu Arnold