From: Russell Simpkins <russellsimpkins@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: ORDER records based on parameters in IN clause
Date: Wed, 29 Jun 2005 07:19:22 -0400
Message-ID: <BAY103-DAV2F286C12D1CD00118F13AB5E00@phx.gbl> (raw)
In-Reply-To: <937a483c3b3a9809ec978a24b9d9af76@biglumber.com>
>> when I say
>> select * from table where id IN (2003,1342,799, 1450)
>> I would like the records to be ordered as 2003, 1342, 799, 1450.
>Just say:
>select * from table where id IN (2003,1342,799, 1450) ORDER BY id;
>If that doesn't work, you will have to be more specific and send us the
exact query.
Order by id will not do what you want, but this should.
Select * from table where id = 2003;
Union all
Select * from table where id = 1342;
Union all
Select * from table where id = 799;
Union all
Select * from table where id = 1450;
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: russellsimpkins@hotmail.com
Subject: Re: ORDER records based on parameters in IN clause
In-Reply-To: <BAY103-DAV2F286C12D1CD00118F13AB5E00@phx.gbl>
* 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