| Author |
Topic  |
|
|
jfm
Posting Yak Master
134 Posts |
Posted - 07/17/2012 : 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 P
I'm trying yo use OUTER JOIN but is not working...
Any ideas? Thanks! |
|
|
lionofdezert
Aged Yak Warrior
Pakistan
864 Posts |
Posted - 07/17/2012 : 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/ |
Edited by - lionofdezert on 07/17/2012 06:34:23 |
 |
|
|
jfm
Posting Yak Master
134 Posts |
Posted - 07/17/2012 : 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
Flowing Fount of Yak Knowledge
Germany
8529 Posts |
Posted - 07/17/2012 : 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
134 Posts |
Posted - 07/17/2012 : 07:53:55
|
I have a problem using INNER JOIN. Is working, but I can create the table.
Using:
Select * from Table_1 INNER JOIN Table_2 ON Table_1.ID = Table_2.ID
Its correct, but I don't have my table, in order to work with the data
So using:
Select Table_1.* INTO Table_3 From Table_1 INNER JOIN Table_2 ON 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
Flowing Fount of Yak Knowledge
Germany
8529 Posts |
Posted - 07/17/2012 : 08:21:08
|
select t1.Id, t2.Column_P into Table_3 from Table_1 as t1 inner 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
134 Posts |
Posted - 07/17/2012 : 09:38:32
|
Thanks for your reply,
I can use the query is working, this way:
select t1.Id, t2.Column_P into Table_3 from Table_1 inner join Table_2 on t1.Id = t2.Id
Many thanks
|
 |
|
| |
Topic  |
|