Re: [SQL] How To Use JOIN? - Mailing list pgsql-sql

From Oliver Elphick
Subject Re: [SQL] How To Use JOIN?
Date
Msg-id 199811171743.RAA22165@linda.lfix.co.uk
Whole thread Raw
In response to How To Use JOIN?  (Takashi Tokunaga <taka-tok@chaos.digital-magic.co.jp>)
List pgsql-sql
Takashi Tokunaga wrote:
  >Hello PGSQL users, I'm having trobule using join statement:

  >3. Now after that worked without any problem, so I now create SELECT
  >   statement:
  >
  >  select * from test1 test2 where code_1 = test.code_2 \g
  >  ERROR:  attribute 'code_2' not found
  >
  >nope that didn't work
  >
  >  select test1.name_1 from test1 test2 where test1.code_1 = test2.code_2 \g
  >  ERROR:  attribute 'code_2' not found
  >
  >Umm... still no change.

junk=>  select * from test1, test2 where code_1 = test2.code_2
junk-> ;
name_1|code_1|name_2|code_2
------+------+------+------
    10|     1|    11|     1
    11|     2|    11|     2
(2 rows)

junk=>  select test1.name_1 from test1, test2 where test1.code_1 = test2.code_2 ;
name_1
------
    10
    11
(2 rows)

You omitted the comma between the table names in the FROM clause.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "For by grace are ye saved through faith; and that not
      of yourselves. It is the gift of God; not of works,
      lest any man should boast."    Ephesians 2:8,9



pgsql-sql by date:

Previous
From: Herouth Maoz
Date:
Subject: Re: [SQL] How To Use JOIN?
Next
From: sqyang
Date:
Subject: optimization