Pretty new to sqlite (and sql). Trying to modify one table using another.
create table Person(Key1 INTEGER, Key2 INTEGER, Name, IsDead, PRIMARY KEY (Key1,Key2));
create table Zombie(Key1 INTEGER, Key2 INTEGER, PRIMARY KEY (Key1,Key2));
I'd like to update IsDead column based on a list provided in Zombie. SQLite apparently can't use join with an update. Considering UPDATE or REPLACE statements. Thank you in advance.
As per @Tyler Ferraro, below is the solution.
UPDATE Person
SET IsDead = 1
WHERE EXISTS
(
SELECT *
FROM Zombie
WHERE Person.Key1 = Zombie.Key1 and Person.Key2 = Zombie.Key2
);
Below works for a single key, but I don't know how to handle composite keys.
UPDATE Person
SET IsDead = 1
WHERE Key1
IN
(
SELECT Key1
FROM Zombie
);