Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compare Records
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01329844
Message ID:
01329849
Views:
19
>Is there a way to compare 2 tables with the same structure and identify the differences?
select myTable1.* ;
union 
select myTable2.* into cursor curPossDiff

select ID, count(*) as Dups from curPossDiff group by ID having Dups > 1 ;
into cursor curChangedIDs

select * from curPossDiff cs LEFT JOIN myTable1 on cs.ID = myTable1.ID ;
where myTable1.ID IS NULL into cursor curAddedRecords
Easy to find deleted records too.
select myTable1.ID from myTable LEFT JOIN myTable2 on myTable1.ID = myTable2.ID ;
where myTable2.ID IS NULL into cursor curDeletedRecords
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform