| From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
|---|---|
| To: | "Reuben D(dot) Budiardja" <techlist(at)voyager(dot)phys(dot)utk(dot)edu> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Help with sorting (ie. ORDER BY expression) |
| Date: | 2005-02-06 13:23:48 |
| Message-ID: | 20050206132348.GA952@wolff.to |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Sat, Feb 05, 2005 at 17:25:06 -0500,
"Reuben D. Budiardja" <techlist(at)voyager(dot)phys(dot)utk(dot)edu> wrote:
>
> Hello,
> I am running postgres-7.3. I have a query like this:
>
> SELECT question_id, question_text
> FROM quiz_table
> WHERE question_id IN (2,10,3,6,4,5);
>
> But I want the output to be sorted in the way I give the question_id,
> something like:
>
> SELECT question_id, question_text
> FROM quiz_table
> WHERE question_id IN (2,10,3,6,4,5)
> ORDER BY question_id (2,10,3,6,4,5)
>
> Is there any way I can do that, so that the output of the query is
You could create a table with the question ids and their rank and join
that table to the above query and order by the rank.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Hallgren | 2005-02-06 14:28:31 | Help with access check |
| Previous Message | Tatsuo Ishii | 2005-02-06 13:19:57 | Re: pgpool simple feature request |