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 |
|
AlexandreSilva
Starting Member
2 Posts |
Posted - 2012-05-23 : 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 table3SELECT Imagem, Periocidade FROM table1 AWHERE A.Imagem in(select REPLACE (clientName,'_DB2','') from table2)but it don't workCan anyone please help |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-05-23 : 07:42:53
|
| Does table3 already exist? If not, trySELECT Imagem, PeriocidadeINTO table3 FROM table1 AWHERE A.Imagem in(select REPLACE (clientName,'_DB2','')from table2)JimEveryday I learn something that somebody else already knew |
 |
|
|
AlexandreSilva
Starting Member
2 Posts |
Posted - 2012-05-23 : 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-PeriocidadeTable2 have fields like:-ClientName-Outcome-StartDateTime-EndDateTimeTable3 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 |
 |
|
|
|
|
|