old.rowid was an error of mine during typing; my apologies.
Even though I have kind of managed to comprehend the logic behind of it, and made it partially work, I have decided to stick with a view which does what I want it to do. The only problem I have now is how can to update an individual value from a row of my choice. ________________________________ From: Igor Tandetnik <itandet...@mvps.org> To: sqlite-users@sqlite.org Sent: Tuesday, August 30, 2011 3:18 PM Subject: Re: [sqlite] Clarification about Triggers stefanos sofroniou <stefanossofroniou...@yahoo.com> wrote: > Now what I want to do is to take two tables, (let's call them temp_01 and > temp_02) that would both have columns id and val, and I > want with a trigger to add temp_01.val with temp_02.val and put their result > in a new table named total. With a trigger firing on which event? A value from which row in temp_01? Add to a value from which row of temp_02? Put the result into which row of total? You talk about these tables as if they were scalars. But they potentially contain many rows with many values. > I have tried something like this: > > create trigger [after_insert_temp_01] > after insert on temp_01 > begin > update total > set val = temp_01.val + temp_02.val > where rowid = old.rowid; > end; old.rowid is not defined in an "after insert" trigger. You are inserting a new row, there's no old row involved. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users