Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D57A847658F for ; Mon, 9 Dec 2002 16:46:34 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id C9FC44764B4 for ; Mon, 9 Dec 2002 16:35:02 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id QAA17510; Mon, 9 Dec 2002 16:34:57 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma017508; Mon, 9 Dec 02 16:34:32 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id QAA18472; Mon, 9 Dec 2002 16:33:06 -0500 Message-ID: <3DF50C6E.2D94936D@nsd.ca> Date: Mon, 09 Dec 2002 16:34:38 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: josh@agliodbs.com Cc: Chris Jewell , pgsql-sql@postgresql.org Subject: Re: Problem with a lookup table! Please help. References: <000f01c29fc5$afc34960$2301a8c0@chrisdomain> <200212091308.34332.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/107 X-Sequence-Number: 10695 Use the AS keyword to introduce a column alias. Select thisverlongtablename.thefirstfield as title, ... from JLL Josh Berkus wrote: > > Chris, > > > In my capacity as a vet student, I'm trying to create a database of > antibiotics. The way that I have set it up so far is to have one main table > listing the antibiotics versus their respective efficacies against the four > major groups of bacteria. Due to the way that my PHP frontend works, I have > assigned a number to the efficacy - 1 being excellent and 5 being poor > efficacy against the particular bacterium. However, I now want to have a new > table which converts numbers into words. The problem is this, if I join the > main table with the "translation" lookup table, the column names for each of > the four categories in the main default to the column name in the lookup > table and hence are all the same. What SQL expression should I use to > translate the cryptic numbers into plain english whilst preserving the column > headings in the main table? > > Please post your table definitions as SQL statements. > > -- > -Josh Berkus > Aglio Database Solutions > San Francisco > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)