Re: Problems with join (no such attribute, but it exists) - Mailing list pgsql-novice

From Manfred Koizar
Subject Re: Problems with join (no such attribute, but it exists)
Date
Msg-id 8p8acv45sf5fkd6taq2op2or2ukebqllf8@4ax.com
Whole thread Raw
In response to Problems with join (no such attribute, but it exists)  (Matej Cepl <cepl@surfbest.net>)
Responses Re: Problems with join (no such attribute, but it exists)
List pgsql-novice
On Wed, 14 May 2003 12:30:07 -0400, Matej Cepl <cepl@surfbest.net>
wrote:
>   grass=> \d tracts_towns2000
>              Table "tracts_towns2000"
>     Column   |         Type          | Modifiers
>   -----------+-----------------------+-----------
>    COMPL_ID  | character varying(18) | not null
>    COUNTY_ID | smallint              | not null
>    TRACT_ID  | integer               | not null
>    TOWN_ID   | smallint              | not null
>    AREA_ID   | smallint              | not null
>   Primary key: tracts_towns2000_pkey

Somehow you managed to create your table with all uppercase column
names.  So you have to keep double quoting these names.

>   grass=> SELECT conv.tract_id, tr.tract FROM tracts_towns2000 conv,
>   tracts2000 tr LIMIT 5;
>   ERROR:  No such attribute or function 'tract_id'

SELECT conv."TRACT_ID", tr.tract FROM tracts_towns2000 conv,
   tracts2000 tr LIMIT 5;

BTW, unless one of these tables has only one row, you almost certainly
want to add a WHERE clause to your query, something like

    WHERE tr.thiscolumn = conv.thatcolumn

Servus
 Manfred

pgsql-novice by date:

Previous
From: "Juliet May"
Date:
Subject: Re: Problems with join (no such attribute, but it exists)
Next
From: "Juliet May"
Date:
Subject: Re: Query regarding Insert Statement!!!!