From: Takashi Tokunaga <taka-tok@chaos.digital-magic.co.jp>
To: pgsql-sql@postgreSQL.org
Subject: How To Use JOIN?
Date: Wed, 18 Nov 1998 00:05:45 +0800
Message-ID: <199811171611.BAA25713@yebisu2.digital-magic.co.jp> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: taka-tok@chaos.digital-magic.co.jp
Subject: Re: How To Use JOIN?
In-Reply-To: <199811171611.BAA25713@yebisu2.digital-magic.co.jp>
References: <199811171611.BAA25713@yebisu2.digital-magic.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox