Re: Help with sorting (ie. ORDER BY expression)

From: Jonel Rienton <jonel(at)road14(dot)com>
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-05 23:38:49
Message-ID: 2c400c7d38be9de473e8eb9f754ca954@road14.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This can be easily done with pl/pgsql, visit the documentation at
http://www.postgresql.org/docs/7.3/interactive/programmer-pl.html

OT: seems like this is a questionnaire/survey application, yes?

- -----
Jonel Rienton
http://blogs.road14.com
Software Developer, *nix Advocate
On Feb 5, 2005, at 4:25 PM, Reuben D. Budiardja 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
>
> question_id, text
> 2 ...
> 10
> 3
> 6
> 4
> 5
>
> Thanks for any help.
>
> RDB
>
> --
> Reuben D. Budiardja
> Dept. Physics and Astronomy
> University of Tennesse, Knoxville, TN
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1

iQA/AwUBQgVK+eAwOVAnbsGCEQJffgCglLCH0/MuBvAWNyIu2UHPJpvwDnYAoLkm
yAPhmAdZf2Pmm330GJvx9Sci
=l+eD
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2005-02-06 00:48:31 Re: Is there a peer-to-peer server solution with PG?
Previous Message Jonel Rienton 2005-02-05 23:37:01 Re: Help with sorting (ie. ORDER BY expression)