Order by provided IDs?

From: Mark Kelly <pgsql(at)wastedtimes(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Order by provided IDs?
Date: 2010-07-14 18:03:25
Message-ID: 201007141903.25271.pgsql@wastedtimes.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi.

If my query is:

SELECT art_id, art_headline, art_date
FROM article
WHERE art_id IN (357, 344, 120, 258, 369, 195, 343, 370);

can I ask Postgres to return the rows in the order of the IDs in the IN
clause? They are in a specific order defined outside the database.

Thanks,

Mark

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Thomas Kellerer 2010-07-14 18:22:44 Re: Order by provided IDs?
Previous Message DMan65 2010-07-13 23:25:59 Need help doing a CSV import