sql - Insert row in a table from an other database with conditions -
i have 2 databases, same structures not same datas, i'm trying insert datas source database target database, when datas don't exist in target (if exist update it, it's working).
this i've done :
insert table select * table@source not exists ( select * table@source ts ts.id=table.id , ts.id2=table.id2 )
but doesn't work...
can me please ?
exemple of want request :
target : id-id2-num 01-001-100 -> updated 02-002-200 -> deleted 04-004-400 -> deleted source : id-id2-num 01-001-111 -> used update target 02-001-020 -> added in target 03-003-300 -> added in target
the update , delete part work fine. i'm having troubles add line part.
ok, i've found error :
insert table select * table@source not exists ( select * table tt tt.id=table.id@source , tt.id2=table.id2@source )
Comments
Post a Comment