*** 2,8 **** _:: Postgres also allows "UPDATE ... FROM ... ", BTW. (As does Ingres --CAU) ! _:: I was working on something where I really wanted to use this construct with SQLite, so I came up with the following hack: --- 2,9 ---- _:: Postgres also allows "UPDATE ... FROM ... ", BTW. (As does Ingres --CAU) ! _:: I was working on something where I really wanted to use this construct ! with SQLite, so I came up with the following hack: *************** *** 58,64 **** UPDATE t1 SET ! measure = ( SELECT measure FROM t2 WHERE t2.key = t1.key ) ; ! _:: But be very careful with this code! The original joined update would only update where a record is found with the key in both tables. This, on the other hand, will update everything in t1, setting measure to NULL if there isn't a record in t2. *TJH:2006-03-24* --- 59,84 ---- UPDATE t1 SET ! measure = ( SELECT measure FROM t2 WHERE t2.key = ! t1.key ) ; ! _:: But be very careful with this code! The original joined update would only ! update where a record is found with the key in both tables. This, on the other ! hand, will update everything in t1, setting measure to NULL if there isn't a ! record in t2. *TJH:2006-03-24* ! ! _:: A variation on this theme so your measure will not be set to NULL if there ! is no data. ! *robewald:2007-02-19*: ! ! -- ! -- emulating "UPDATE ... FROM" in SQLite ! -- ! -- ! UPDATE ! t1 ! SET ! measure = ( SELECT measure FROM t2 WHERE t2.key = ! t1.key ) WHERE t1.key = ( SELECT key FROM t2 WHERE t2.key=t1.key) ! ;