X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 327A1D1E2C2 for ; Thu, 1 Apr 2004 15:27:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55333-04 for ; Thu, 1 Apr 2004 11:27:34 -0400 (AST) Received: from srexchimc2.eng.emc.com (srexchimc2.lss.emc.com [168.159.100.11]) by svr1.postgresql.org (Postfix) with ESMTP id 0DFFED1E8FC for ; Thu, 1 Apr 2004 11:27:29 -0400 (AST) Received: by srexchimc2.lss.emc.com with Internet Mail Service (5.5.2657.72) id <2AR84ZXL>; Thu, 1 Apr 2004 10:27:32 -0500 Message-ID: From: "malia, sean" To: "'pgsql-sql@postgresql.org'" Subject: Re: DB question - Merging data from one table to another. Date: Thu, 1 Apr 2004 10:27:32 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C417FD.DA2A26E2" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/18 X-Sequence-Number: 17393 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C417FD.DA2A26E2 Content-Type: text/plain Hello, I'm not sure if this is even possible, but I'll throw it by you anyway. Say I have 2 tables: Table1: With columns number and name 1.1 test1 1.2 test2 1.3 test3 1.4 test4 Table2: With column number and results 1.1 pass 1.2 fail 1.3 pass 1.4 fail What I would like to do is add a new column to Table2 called name and populate the name from table 1 and add it to table 2. So, table 2 will look like: 1.1 pass test1 1.2 fail test2 1.3 pass test3 1.4 fail test4 **NOTE: in same cases if you do a "select name from table1 where number='1.1'" you might get multiple matches, I guess we would need to use "distinct" ? I've never interacted two tables before, so I'm not even sure where to start with this. I'm using postgres 7.4. Thanks all. ------_=_NextPart_001_01C417FD.DA2A26E2 Content-Type: text/html Content-Transfer-Encoding: quoted-printable RE: DB question - Merging data from one table to another.

Hello,

I'm not sure if this is even possible, but= I'll throw it by you anyway. 

Say I have 2 tables:

Table1:  With columns number and name=

1.1     test1
1.2     test2
1.3     test3
1.4     test4

Table2: With column number and results

1.1     pass
1.2     fail
1.3     pass
1.4     fail

What I would like to do is add a new colum= n to Table2 called name and populate the name from table 1 and add it to ta= ble 2.  So, table 2 will look like:

1.1     pass &nbs= p;  test1
1.2     fail &nb= sp;  test2
1.3     pass &nb= sp;  test3
1.4     fail &nb= sp;  test4

**NOTE: in same cases if you do a "se= lect name from table1 where number=3D'1.1'" you might get multiple mat= ches, I guess we would need to use "distinct" ?

I've never interacted two tables before, s= o I'm not even sure where to start with this.

I'm using postgres 7.4.  

Thanks all.

------_=_NextPart_001_01C417FD.DA2A26E2--