//存在替换
replace into SchemaBackup.Table select * from Schema.Table as a where exists (select * from SchemaBackup.Table as b where a.id=b.id and a.guid=b.guid and a.intValue>b.intValue);
replace into SchemaBackup.Table select * from Schema.Table a where exists (select * from SchemaBackup.Table b where a.id=b.id and a.guid=b.guid and a.version=b.version and b.history is NULL);
replace into SchemaBackup.Table select * from Schema.Table a where exists (select * from SchemaBackup.Table b where a.id=b.id and a.guid=b.guid and a.version>b.version);
//不存在插入
insert into SchemaBackup.Table select * from Schema.Table a where not exists (select * from SchemaBackup.Table b where a.id=b.id and a.guid=b.guid);
insert into SchemaBackup.Table select * from Schema.Table a where not exists (select * from SchemaBackup.Table b where a.id=b.id and a.guid=b.guid);
mysql合并数据库
最新推荐文章于 2022-12-20 19:15:00 发布