Re: [GENERAL] Sorting a table... - Mailing list pgsql-general

From Stan Jacobs
Subject Re: [GENERAL] Sorting a table...
Date
Msg-id Pine.LNX.4.05.9911300912230.18406-100000@crease.jtek.com
Whole thread Raw
In response to Sorting a table...  (Jesse Scott <jscott@bmi.net>)
List pgsql-general
> Hello all, I'm new to this list so forgive me if this question get's asked
> a lot. (I did search the archives...)

A standard SQL reference might help a lot, since this is more in the
domain of SQL syntax than PostgreSQL help.


> list them out of order (one of the fields is a sequential ID number).  Is
> there anyway to do a "sort by" or something similar?  Or do I need to set
> the ID number to be some sort of index type?

Just add the 'ORDER BY' tag to the end of your query....

    e.g. 'SELECT * FROM users ORDER BY seq_id_number'

... and it will return the results sorted by seq_id_number.  (Of course,
replace this variable with whatever your sequential id number field is
actually called.)


    HTH,

    - Stan -



pgsql-general by date:

Previous
From: Ed Loehr
Date:
Subject: Re: [GENERAL] Sorting a table...
Next
From: Bradford Hovinen
Date:
Subject: Re: [GENERAL] SQL error in PostgreSQL 6.5.3