SQLite doesn't support updates with joins. (see this closely related SO question)
Let's say I have a table data
with these columns:
INTEGER id
TEXT foo
TEXT bar
TEXT baz
and I have another table selection
with one column INTEGER id
.
What I would like to do is given an integer id srcID
, to copy the foo
and bar
values from the data
row src to the data
rows where the ids match the selection table.
In "standard" SQL (or at least the MySQL variant), this is something like
UPDATE data, selection, data as src
SET data.foo = src.foo, data.bar = src.bar
WHERE data.id = selection.id
AND src.id = ?
(?
= prepared statement value set to srcID
)
Any suggestions?