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 |
|
aspcindys
Starting Member
2 Posts |
Posted - 2005-09-03 : 20:09:59
|
| I have two tables tbl1 and tbl2tbl1 has 10 fields named tbl1.id tbl1.field2 tbl1.field3 tbl1.field4tbl2 has only three fields tbl2.field1 tbl2.field2 tbl2.field3 Now i need to insert values into tbl1::tbl1.field1 tbl1.field2 tbl1.field3from tbl2.field1 tbl2.field2 tbl2.field3 respectively, but i need to make sure if tbl2.field3 value is already there in tbl1.field3 then we don't need import those records. so we only need records if value of tbl2.field3 is not already there in tbl1.field3.Please let me know What statement do I need to write so i can import all data from tbl2 into tbl1 by comparing as above. |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-09-04 : 01:39:24
|
| Try this Insert Into Tbl1 (field1,field2,field3) Select field1,field2,field3 From Tbl2 Where field3 Not in (Select field3 From Tbl1)Complicated things can be done by simple thinking |
 |
|
|
|
|
|