Received: from yebisu2.digital-magic.co.jp (yebisu2.digital-magic.co.jp [203.181.89.3]) by hub.org (8.9.1/8.9.1) with ESMTP id LAA26253 for ; Tue, 17 Nov 1998 11:11:43 -0500 (EST) (envelope-from taka-tok@chaos.digital-magic.co.jp) Received: from tokumebi (dyn246ppp89.pacific.net.sg [210.24.246.89]) by yebisu2.digital-magic.co.jp (8.8.3/8.8.3) with SMTP id BAA25713 for ; Wed, 18 Nov 1998 01:11:05 +0900 (JST) Message-Id: <199811171611.BAA25713@yebisu2.digital-magic.co.jp> X-Sender: taka-tok@203.181.89.25 X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.3-Jr2 (32) Date: Wed, 18 Nov 1998 00:05:45 +0800 To: pgsql-sql@postgreSQL.org From: Takashi Tokunaga Subject: How To Use JOIN? Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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