|
detlion1643
Yak Posting Veteran
67 Posts |
Posted - 2010-04-20 : 10:35:50
|
| So, regarding the first part of what I am doing, that was taken care of yesterday - realizing we needed to set a staging table and perform a merge (to update from a bulk insert). Now, it's getting a little trickier and am looking for a way to basically use the updated data and that's it (without deleting more than necessary from the original table).ex) original table has this:id,sku,price,stock1 , 1 , 50 , 101 , 2 , 55 , 20 / file 1----------------1 , 3 , 60 , 101 , 4 , 60 , 0 / file 2I put a line in because so many products are filled by excel files - about 50 in total. Now, since these excel files can contain 20,000+ products are even as few as 50 (and some repeat across files), this is where I am stumped now.Lets say file 1 changes to contain 1 product like this:1 , 1 , 60 , 5and file 2 changes to 3 products like this:1 , 3 , 60 , 51 , 5 , 50 , 101 , 6 , 40 , 5the final table would need to be updated like this:1 , 1 , 60 , 51 , 3 , 60 , 51 , 5 , 50 , 101 , 6 , 40 , 5Without deleting the whole contents of the original table and rebuilding the whole thing, is there even a logically possible way to compare tables to be merged - what if i add a column stating what file it comes from? compare all from file 1 with the table waiting to merged from the new file 1? If anything is not in the new file anymore, delete it? |
|