Home > database >  Urgent for two of the same table data comparison statements, nasty online, etc.
Urgent for two of the same table data comparison statements, nasty online, etc.

Time:09-21

I am in the company responsible for the operations made a big mistake, is also a small white SQL,

Modified the SQL in the background data inventory, ERP, ERP data revised but I don't remember what data,

Such as table INVLA modified the data in it, and now how much to find out the changes of the modified?

Data backup, I restored now rename a database name TEST,
INVLA table column is LA001 -- -- -- -- -- LA10

LA001 LA002, LA003 is the key value did not change, only change the LA006, LA007, LA008

Now ask how to write a statement out of the modified data and restore, nasty online, etc.,

CodePudding user response:

Find a database matching tool can be compared, tool such as VS in there

CodePudding user response:

Add a list of marks, use the update statement to update the logo

CodePudding user response:

 
- the first query to see if you modify the record

The SELECT a. A001 AS LA001_A, a. A002 AS LA002_A, a. A003 AS LA003_A, a. A006 AS LA006_A, a. A007 AS LA007_A, a. A008 AS LA008_A
B.L A001 AS LA001_B, B.L A002 AS LA002_B, B.L A003 AS LA003_B, B.L A006 AS LA006_B, B.L A007 AS LA007_B, B.L A008 AS LA008_B
FROM the TEST. The DBO. INVLA A
The JOIN ERP. The DBO. INVLA B ON a. A001=B.L A001 AND a. A002=B.L A002 AND a. A003=B.L A003
WHERE a. A006 & lt;> B.L A006 OR a. A007 & lt;> B.L A007 OR a. A008 & lt;> B.L A008

- if the results of the query above right, use the following update

UPDATE ERP. The DBO. INVLA
The SET LA006=a. A006,
LA007=a. A007,
LA008=a. A008
FROM the TEST. The DBO. INVLA A
The JOIN ERP. The DBO. INVLA B ON a. A001=B.L A001 AND a. A002=B.L A002 AND a. A003=B.L A003
WHERE a. A006 & lt;> B.L A006 OR a. A007 & lt;> B.L A007 OR a. A008 & lt;> B.L A008