Chris wrote:
Ok, this should be simple, but I banging my head on this one:
Is there an Update statment that can accomplish the same as this Merged
statement?
MERGE INTO New_Table NT
USING Old_Table OT
ON OT.id = NT.id
WHEN MATCHED THEN
UPDATE
SET NT.Foo = OT.Foo
I'm on iSeries DB2, hence MERGE is not supported??
UPDATE New_Table NT
SET NT.Foo = (SELECT OT.Foo FROM Old_Table OT WHERE OT.id = NT.id)
WHERE NOT EXISTS(SELECT 1 FROM Old_Table OT WHERE OT.id = NT.id)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab