Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== update by joining tables ====== You want to update one table with values from another (make sure you want to update and not insert). Each row corresponds to one row in another table, so a join needs to be used. Use 'from' with the update statement. <code sql> update TableToBeModified set fieldA = t.fieldA from TableToBeJoined t where TableToBeModified.fieldB = t.fieldB </code> There are several gotchas for this: * TableToBeModified cannot be aliased, so use its full name * only one table can be updated at a time, so you can't say "set t.fieldC = true" in the query above docs/postgres/update_by_joining_tables.txt Last modified: 2009/06/10 11:03by billh