samedi 18 avril 2015

Change value of column to a value from a foreign column

Hello my table looks like this:



CREATE TABLE my_eav(
id INTEGER PRIMARY KEY AUTOINCREMENT,
k TEXT NOT NULL,
v TEXT,
v_link INTEGER,
UNIQUE(k, v) ON CONFLICT REPLACE,
FOREIGN KEY(v_link) REFERENCES posts(id) ON UPDATE ???
);


v_link is the id column of another table, "posts".


When the referenced post record is updated, I'd like to change the "v" column on this table to the "title" column of the posts table. Is that possible?


Something like



... ON UPDATE SET v = posts.title


but of course this doesn't work :(


Aucun commentaire:

Enregistrer un commentaire