Re: Need: Cool method of Syncing two tables
Posted in 1995
"David Chan" — — source: Informix-list mailing list archive (1991-1998)
For the update part, I tried doing: UPDATE table1 SET (data1,data2) = ((select data1, data2 FROM table2 WHERE table2.key1 = table1.key1 AND table2.key2 = table1.key2)) WHERE key1 || key2 IN (select key1 || key2 from table2) but this resulted in a seq scan of table1 even though it could use the primary key on table1. However, if the primary key was only one field, you can do: UPDATE table1 SET (data1,data2) = ((SELECT data1, data2 FROM table2 WHERE table2.key1 = table1.key1)) WHERE key1 IN (select key1 from table2) This would be fast because it uses table1 primary key. David W Chan Objective Research Ltd dwc@cix.compulink.co.uk