Обсуждение: ORDERING alphabetically
Hi there, Does anyone know how to get results from a query in alphabetical order (for one field such as surname). I skimmed over the documentation and no luck. The field type for surname is varchar - Maybe this is why order by didn't work. Thankyou, Abe
SELECT * FROM table ORDER BY table; that seems to do the trick for me when I need to order things alphabeticly. Mike ----- Original Message ----- From: "abe" <abe@fish.tm> To: <pgsql-general@postgresql.org> Sent: Wednesday, August 09, 2000 10:15 AM Subject: [GENERAL] ORDERING alphabetically > Hi there, > > Does anyone know how to get results from a query in alphabetical order (for one > field such as surname). I skimmed over the documentation and no luck. > > The field type for surname is varchar - Maybe this is why order by didn't work. > > Thankyou, > Abe >
On Wed, 9 Aug 2000, abe wrote:
> Does anyone know how to get results from a query in alphabetical order
> (for one field such as surname). I skimmed over the documentation and
> no luck.
Use the ORDER BY clause in your query:
SELECT surname, firstname FROM names ORDER BY surname;
Brett W. McCoy
http://www.chapelperilous.net/~bmccoy/
-------------------------------------------------------------------------------
But soft you, the fair Ophelia:
Ope not thy ponderous and marble jaws,
But get thee to a nunnery -- go!
-- Mark "The Bard" Twain