I have a database with account numbers and card numbers. I match these to a file to update any card numbers to the account number, so
account numbers
card numbers
update
I had the same problem with foo.new being set to null for rows of foo that had no matching key in bar. I did something like this in Oracle:
foo.new
null
foo
bar
update foo set foo.new = (select bar.new from bar where foo.key = bar.key) where exists (select 1 from bar where foo.key = bar.key)