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 |
|
kory27
Starting Member
35 Posts |
Posted - 2008-05-01 : 22:43:08
|
| Hi. I have 2 tables, this structure (basically);Code Title1 AAAAA2 BBBBB3 CCCCC4 DDDDDCode Title1 AAAAA2 BBBBBBasically, what is the best method, ie. not in, left join, etc to write this insert query? I feel like I know this, but mostly I want to make sure I am using the most efficient way. There are 1.1M records in the first table, named Complete_Products, and 979K in tblProducts. I already ran the update query that selected on the ProductCode column in both that updated tblProduct for the records that were also in Complete_Products. That ran fine, a bit long, but it worked and updated the 805,273 records they had in common. Now I need to insert the new records that are in Complete_Products that are not in tblProducts.Thanks so much for your help in advance. |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-05-02 : 00:18:59
|
i'd use a left join. elsasoft.org |
 |
|
|
amrindia
Starting Member
8 Posts |
Posted - 2008-05-02 : 01:16:47
|
| Use Exists and Not Exists i.e Correlated JoinsMichaelRaj Arokiyasamy |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-02 : 02:10:57
|
| I would have also done using the left join method |
 |
|
|
|
|
|