How To Use JOIN? - Mailing list pgsql-sql

From Takashi Tokunaga
Subject How To Use JOIN?
Date
Msg-id 199811171611.BAA25713@yebisu2.digital-magic.co.jp
Whole thread Raw
Responses Re: [SQL] How To Use JOIN?  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Re: [SQL] How To Use JOIN?  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-sql
Hello PGSQL users, I'm having trobule using join statement:

I've created two tables and trying to compare contents of two
tables and receive results which found on two tables equaled.

------Here's what I did ------

1. I create two tables:

  create table test1 (
    name_1  varchar(10),
    code_1 int
  )\g

  create table test2 (
   name_2  varchar(10),
   code_2 int
  )\g

2. Entered sample data:

  insert into test1 values ( '10', 1) \g
  insert into test1 values ( '11', 2) \g

  insert into test2 values ( '11', 1) \g
  insert into test2 values ( '11', 2) \g

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.

------

Mmm... Any ideas?
If I can get value of test1.name_1 which also had equal value on code_1
and test2.code_2, I'll solve my trouble.  It shouldn't be that complex but it's
been driving me nuts for few hours.

I'm using postgresql-6.3.2 under FreeBSD 2.2.6.

Thanx in Advance,

Takashi



pgsql-sql by date:

Previous
From: pierre@desertmoon.com
Date:
Subject: Blatant plug
Next
From: Herouth Maoz
Date:
Subject: Re: [SQL] How To Use JOIN?