Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 05, 2005 at 17:25:06 -0500,
  "Reuben D. Budiardja" <techlist@xxxxxxxxxxxxxxxxxxxx> 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.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux