先把你的数据导入到表temptable中 update oldtableset Brand=(select brand from temptable o where Partno=Partno,Quantity=Quantity,UserId=Quantity ), DateCode=(select DateCode from temptable o where Partno=Partno,Quantity=Quantity,UserId=Quantity ), Price=(select Price from temptable o where Partno=Partno,Quantity=Quantity,UserId=Quantity ), Package=(select Packagefrom temptable o where Partno=Partno,Quantity=Quantity,UserId=Quantity ), Note=(select Note temptable o where Partno=Partno,Quantity=Quantity,UserId=Quantity ) where exists( select * from temptable owhere Partno=Partno,Quantity=Quantity,UserId=Quantity ) delete temptable t--注意是templtable 不要把以前的数据删除了,这里是删除--以前的数据 where exists( select * from oldtemp where partno=Partno and Quantity=Quantity and UserId=UserId ) --不存在的数据插入表中 insert into oldtable( UserId,PartNo,Brand,DateCode,Quantity,Price,Package,Note ) select UserId,PartNo,Brand,DateCode,Quantity,Price,Package,Note from temptable