Re: [GENERAL] Sorting a table...

From: Stan Jacobs <jacobs(at)jtek(dot)com>
To: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Sorting a table...
Date: 1999-11-30 17:15:34
Message-ID: Pine.LNX.4.05.9911300912230.18406-100000@crease.jtek.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 -

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bradford Hovinen 1999-11-30 19:12:20 Re: [GENERAL] SQL error in PostgreSQL 6.5.3
Previous Message Ed Loehr 1999-11-30 17:05:46 Re: [GENERAL] Sorting a table...