Hi guys,

I have two tables T1, T2 - identical in fields [Index1 (INT), Index2(INT),
Count(INT), Value(INT)]
I would like to merge the content of T1 into T2 using the following ruels:
1. Copy into T2 data from T1 where Index1 AND Index2 (like two keys, PK and
SK) do not exist in T2
2. In case that there are common rows between T1 and T2, where common means
T1[Index1, Index2] and T2[Index1, Index2] are the same - update T2.Count and
T2.Value ONLY IF T1.Count has a greater value

I am looking for an efficient SQLite statement to make it work.

Any ideas?

Nadav.
-- 
View this message in context: 
http://old.nabble.com/Smart-merge-tp32873851p32873851.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to