Removing Duplicates

hewstone999

Registered User.
Local time
Today, 15:05
Joined
Feb 27, 2008
Messages
37
I have two tables: “tmptable” and “CC_CODES”

Both tables contain the same data; however the “tmptable” contains updated data. How can I compare both tables and remove all the duplicate in the tmptable, leaving only the updated data.

I will be comparing the fields “IsMandatory” from both tables
 
I have two tables: “tmptable” and “CC_CODES”

Both tables contain the same data; however the “tmptable” contains updated data. How can I compare both tables and remove all the duplicate in the tmptable, leaving only the updated data.

I will be comparing the fields “IsMandatory” from both tables
Link both tables to their primary key fields and compare the fields “IsMandatory” from both tables.
Code:
delete tmptable.* 
from tmptable inner join CC_CODES 
   on tmptable.id = CC_CODES.id 
where tmptable.IsMandatory <> CC_CODES.IsMandatory
Enjoy!
 

Users who are viewing this thread

Back
Top Bottom