I have 2 tables. one from yesterday (300k rows) and another one from today with the same count of rows but the data changes in some columns.
Those two tables have around 120 columns.
How can i update only the changes.
I have tried using delete :
delete from tableA
where id in (select id from tableB)
But it too slow.
Also tried
update tableA inner join tableB
on tableA.id=TableB.id
And it didn't worked.
You have to set the values in your update query to get the changes.
Example:
update tableA inner join tableB on tableA.id=TableB.id
set tableA.col1=TableB.col1,
tableA.col2=TableB.col2,
tableA.col3=TableB.col3;
and also you can add more conditions in where
clause to make query run on filtered records.
delete from tableA where id in (select id from tableB)
Instead of above query try this:-
Delete tableA from tableA left Join tableB ON tableA.id = tableB.id where tableB.id IS NOT NULL;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.