Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jfm
Posting Yak Master
145 Posts |
Posted - 2012-07-17 : 06:20:28
|
| Hi there, I have Table_1 and Table_2. Table_1 has just Column_A, Table_2 has Column_A and many other columns.I need to take the info from Table_1.Column_A and match with the same values of Table_2.ColumnA Creating a New_Table using Table_2.Column_A (matched with Table_1.ColumnA values) and Column_P. New Table= ColumnA, Column PI'm trying yo use OUTER JOIN but is not working... Any ideas? Thanks! |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2012-07-17 : 06:33:31
|
| unable to understand Creating a New_Table using Table_2.Column_A (matched with Table_1.ColumnA values) and Column_P. New Table= ColumnA, Column P--------------------------http://connectsql.blogspot.com/ |
 |
|
|
jfm
Posting Yak Master
145 Posts |
Posted - 2012-07-17 : 06:50:46
|
| Sorry for my explanation. In Table_2, I have ID_Column and Postcode_Column.In table_1, I only have ID_Column . I need to match, the ID's that I have equal in both Tables, and create a New_Table that contains ID_Column and Postcode_Column (only the ones that matches with the ID_Column)Thanks a lot |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-07-17 : 06:53:04
|
use inner join No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
jfm
Posting Yak Master
145 Posts |
Posted - 2012-07-17 : 07:53:55
|
| I have a problem using INNER JOIN. Is working, but I can create the table. Using: Select * from Table_1INNER JOIN Table_2ON Table_1.ID = Table_2.ID Its correct, but I don't have my table, in order to work with the dataSo using: Select Table_1.*INTO Table_3From Table_1INNER JOIN Table_2ON Table_1.Id = Table_2.ID Table_3 just has the ID column, instead of having all the columns. And I need the data that I have using the first query. Im sure im missing something in the process, but I don't know what.Any idea? Many thanks |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-07-17 : 08:21:08
|
selectt1.Id,t2.Column_Pinto Table_3from Table_1 as t1inner join Table_2 as t2 on t1.Id = t2.Id No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
jfm
Posting Yak Master
145 Posts |
Posted - 2012-07-17 : 09:38:32
|
| Thanks for your reply, I can use the query is working, this way: selectt1.Id, t2.Column_Pinto Table_3from Table_1 inner join Table_2 on t1.Id = t2.IdMany thanks |
 |
|
|
|
|
|
|
|