You can simulate either a two-pass or one-pass UPDATE <table> SET ... FROM 
<table>, <more tables ...> WHERE <conditions to generate update set>

By doing one or the other of the following (depending on whether you want 
one-pass or two-pass).

for a one-pass update:

BEGIN IMMEDIATE;
SELECT <table>.rowid, <SET variables> FROM <tables ...> WHERE <join conditions>
fetch a row
  UPDATE <table> SET x=?, ...  WHERE rowid=? -- bind the result set to the 
parameters and execute
when you run out of rows,
COMMIT;

For a two pass update BEGIN IMMEDIATE then either (a) SELECT into a temp table 
and do the update above from that table, or (b) store the rows in memory and 
then do the update afterwards.  If you used a temp table, drop it before 
committing.

> I am using quite often SQL statements that update the data of one table
> with data from another table. This leads to some quite complex (and slow)
> statements because SQLite3 is not supporting a FROM clause in update
> statements. I am just wondering why the FROM clause is not supported by
> SQLite3?! Is this too complex to implement or is there simply no demand
> for these type of statements?




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to