| Author |
Topic  |
|
|
AlexandreSilva
Starting Member
2 Posts |
Posted - 05/23/2012 : 07:31:45
|
Hello, i am a beginner in sql Server and i need to do a job but i don't know how to do it.
i have two table (table1 and table2) and i have to validate if a spcific column from table1 exists on table2 and insert the result to a new table that is composed with fileds from table1 and table2.
i done this...
INSERT INTO table3 SELECT Imagem, Periocidade FROM table1 A WHERE A.Imagem in (select REPLACE (clientName,'_DB2','') from table2)
but it don't work
Can anyone please help |
|
|
jimf
Flowing Fount of Yak Knowledge
USA
2868 Posts |
Posted - 05/23/2012 : 07:42:53
|
Does table3 already exist? If not, try SELECT Imagem, Periocidade INTO table3 FROM table1 A WHERE A.Imagem in (select REPLACE (clientName,'_DB2','') from table2)
Jim
Everyday I learn something that somebody else already knew |
 |
|
|
AlexandreSilva
Starting Member
2 Posts |
Posted - 05/23/2012 : 09:20:31
|
Thank you Jim For your answer, but i need to put in table 3 columns from table2 also.
For exemple:
Table 1 have fields like: -Imagem -Tipo_Backup -Periocidade
Table2 have fields like: -ClientName -Outcome -StartDateTime -EndDateTime
Table3 need to be composed by -Imagem (from table1) -Tipo_Backup (from Table1) -Periocidade (from Table1) -Outcome (from Table2) -StartDatetime (from Table2) -EndDatetime (from Table2)
Thanks in advance,
Alex
|
 |
|
| |
Topic  |
|