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

From Matej Cepl
Subject Problems with join (no such attribute, but it exists)
Date
Msg-id slrnbc4rof.5q1.cepl@komensky.surfbest.net
Whole thread Raw
Responses Re: Problems with join (no such attribute, but it exists)
List pgsql-novice
Hi,

I do probably something very silly, but I am total novice in SQL world
(and social scientist, so no CS professional), but I need PostgreSQL
back-end for Grass, so I thought I could try to do some light SELECTing.
Well, I stumbled pretty early:

   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

   grass=> \d tracts2000
           Table "tracts2000"
      Column   |  Type   | Modifiers
   ------------+---------+-----------
    objectid   | bigint  |
    area       | real    |
    perimeter  | real    |
    state      | text    |
    county     | text    |
    tract      | text    |
    ct_id      | text    |
    logrecno   | text    |
    blk_count  | integer |
    total_pop  | bigint  |
    samp_pop   | bigint  |
    dry_pct    | real    |
    dry_acres  | real    |
    dry_sqmi   | real    |
    dry_sqkm   | real    |
    shape_area | text    |
    shape_len  | text    |

   grass=> SELECT * FROM tracts_towns2000 conv, tracts2000 tr LIMIT 1;
         COMPL_ID      | COUNTY_ID | TRACT_ID | TOWN_ID | AREA_ID
    | objectid |    area     | perimeter | state | county | tract
    |    ct_id    | logrecno | blk_count | total_pop | samp_pop | dry_pct
    | dry_acres | dry_sqmi | dry_sqkm |              shape_area
    | shape_len
    14000US25017341100 |        17 |   341100
    |       5 |       5 |        1 | 2.55159e+07 |   45288.6 | 25    | 001
    | 010100 | 25001010100 | 0000856  |       137 |      3431 |     3431
    |  0.9805 |   6181.92 |    9.659 |   25.017 | 2.55158949367e+007
    4.52885899988e+004 |
   (1 row)

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

Can anybody explain me, which stupidy I have commited?

   Thanks,

      Matej Cepl

--
Matej Cepl,
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

pgsql-novice by date:

Previous
From: Yovko Ilchev Yovkov
Date:
Subject: Insert on create table
Next
From: "Octavio Alvarez"
Date:
Subject: MSAccess-like Last() with sorting before grouping