From: | Jean-Luc Lachance <jllachan(at)nsd(dot)ca> |
---|---|
To: | josh(at)agliodbs(dot)com |
Cc: | Chris Jewell <vs0u8055(at)liv(dot)ac(dot)uk>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Problem with a lookup table! Please help. |
Date: | 2002-12-09 21:34:38 |
Message-ID: | 3DF50C6E.2D94936D@nsd.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Jewell | 2002-12-09 22:21:42 | Re: Problem with a lookup table! Please help. |
Previous Message | Josh Berkus | 2002-12-09 21:08:34 | Re: Problem with a lookup table! Please help. |