Re: Problems with join (no such attribute, but it exists)

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Matej Cepl <cepl(at)surfbest(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problems with join (no such attribute, but it exists)
Date: 2003-05-16 17:49:13
Message-ID: 8p8acv45sf5fkd6taq2op2or2ukebqllf8@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 14 May 2003 12:30:07 -0400, Matej Cepl <cepl(at)surfbest(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Juliet May 2003-05-16 17:56:08 Re: Query regarding Insert Statement!!!!
Previous Message Juliet May 2003-05-16 17:46:28 Re: Problems with join (no such attribute, but it exists)