Re: DB question - Merging data from one table to another. - Mailing list pgsql-sql

From malia, sean
Subject Re: DB question - Merging data from one table to another.
Date
Msg-id F98A1E742671C244BE48E009FD29647B03DA2803@srtittle.eng.emc.com
Whole thread Raw
Responses Re: DB question - Merging data from one table to another.  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-sql
<p><font face="Arial" size="2">Hello,</font><p><font face="Arial" size="2">I'm not sure if this is even possible, but
I'llthrow it by you anyway.  </font><p><font face="Arial" size="2">Say I have 2 tables:</font><p><font face="Arial"
size="2">Table1: With columns number and name </font><p><font face="Arial" size="2">1.1     test1</font><br /><font
face="Arial"size="2">1.2     test2</font><br /><font face="Arial" size="2">1.3     test3</font><br /><font face="Arial"
size="2">1.4    test4</font><p><font face="Arial" size="2">Table2: With column number and results</font><p><font
face="Arial"size="2">1.1     pass</font><br /><font face="Arial" size="2">1.2     fail</font><br /><font face="Arial"
size="2">1.3    pass</font><br /><font face="Arial" size="2">1.4     fail</font><p><font face="Arial" size="2">What I
wouldlike 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:</font><p><font face="Arial" size="2">1.1     pass    test1</font><br /><font face="Arial"
size="2">1.2    fail    test2</font><br /><font face="Arial" size="2">1.3     pass    test3</font><br /><font
face="Arial"size="2">1.4     fail    test4</font><p><font face="Arial" size="2">**NOTE: in same cases if you do a
"selectname from table1 where number='1.1'" you might get multiple matches, I guess we would need to use "distinct"
?</font><p><fontface="Arial" size="2">I've never interacted two tables before, so I'm not even sure where to start with
this.</font><p><font face="Arial" size="2">I'm using postgres 7.4.   </font><p><font face="Arial" size="2">Thanks all.
</font>

pgsql-sql by date:

Previous
From: Kyle
Date:
Subject: Simple insert not returning
Next
From: abhi
Date:
Subject: Getting the ranks of results from a query