Re: [SQL] How To Use JOIN?

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: Takashi Tokunaga <taka-tok(at)chaos(dot)digital-magic(dot)co(dot)jp>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] How To Use JOIN?
Date: 1998-11-17 17:43:12
Message-ID: 199811171743.RAA22165@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Elphick(at)lfix(dot)co(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message Lendvary Gyorgy 1998-11-18 15:12:08 createdb problem
Previous Message Herouth Maoz 1998-11-17 16:36:35 Re: [SQL] How To Use JOIN?