From: Richard Huxton <dev@archonet.com>
To: blake@shopwhatcom.com
To: pgsql-sql@postgresql.org
Subject: Re: Proper SQL syntax requested
Date: Tue, 27 Apr 2004 13:06:42 +0100
Message-ID: <200404271306.42790.dev@archonet.com> (raw)
In-Reply-To: <adb08a4b.0404211541.438e8cb5@posting.google.com>
References: <adb08a4b.0404211541.438e8cb5@posting.google.com>
On Thursday 22 April 2004 00:41, Blake wrote:
>
> Select * from floors Where system = 1 ORDER by make
>
> This sorts by the Serial ID's in column make
>
> I would like to be able to sort by the actual Names associated back
> from the ID's. Anyway of doing this??
You don't say which table contains the name in question. Assuming we want
column make_name from table make_description with an id of make_id then:
SELECT floors.* FROM floors, make_description
WHERE system=1 AND floors.make = make_description.make_id
ORDER BY make_description.make_name;
This is called a join. Any book on databases/SQL should discuss this sort of
stuff.
--
Richard Huxton
Archonet Ltd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, blake@shopwhatcom.com
Subject: Re: Proper SQL syntax requested
In-Reply-To: <200404271306.42790.dev@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox