Apologies if I'm asking an obvious question, but I've searched and tried various options and have not been able to arrive at an UPDATE statement in SQLite that does what I need.
I've two tables with a unique identifier that enables me to link them. I'm wanting to update the values of a particular field in table "target" with the contents of a corresponding field in table "source" where the corresponding field in table "source" is not null. target [ID, resource] source [ID, resource] Both tables are indexed on ID, which is a unique identifier There may or may not be a record with a matching ID in table "source" Where the ID's match (and resource in "source" is not NULL) I want to overwrite the corresponding resource field in "target" with the content of the resource field of the matching record of "source" I've tried the following statement, but the end result is all records in target get the same resource value written: UPDATE target SET resource = ( SELECT t.resource FROM target t WHERE ( t.ID = ID AND t.resource IS NOT NULL ) );