Re: How do I extract ONE particular field, when multiple table contain

From: Arne Weiner <aswr(at)gmx(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: How do I extract ONE particular field, when multiple table contain
Date: 2001-09-12 12:54:23
Message-ID: 3B9F5AFF.AD76E2A6@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


If you refere to more than one table in a query, you have to specify
which column to which table belongs. So your query must be

Select XID, xi.DENOM, PRICE, FRT, CTID From XItem xi, Category c Where
xi.System=1 and xi.Category=c.Index

Arne.

Olle Wijk wrote:
>
> Hi,
>
> I am pretty new att using SQL-quires, could anyone help me with this
> one:
>
> I want to do the following SQL-query:
>
> Select XID, DENOM, PRICE, FRT, CTID From XItem xi, Category c Where
> xi.System=1 and xi.Category=c.Index
>
> the problem is that the field 'DENOM' is present in both table 'XItem'
> and
> 'Category' (it is a text description field where you explain whatever
> you
> want). Therefore I get the following complaint when I run the query:
>
> Error msg: "The specified fiel 'DENOM' could refer to more than one
> table listed
> in the FROM clause of your SQL-statement"
>
> The DENOM-field I actually want is the one belonging to the
> XItem-table.
> I would most appreciate if someone could give me a hint how to alter
> the
> SELECT-statement above so that it does what I want.
>
> Regards
>
> /olw

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Yoann 2001-09-12 13:47:01 Re: How do I extract ONE particular field, when multiple table contain the same field name?
Previous Message Yoann 2001-09-12 10:18:35 Re: Combine query views into one SQL string