These two different tables will be used in my UDPATE statement examples below.
If you want to review the complete syntax of the UPDATE statement then please refer to Books Online.
Multiple columns can also be tested for INSERT or UPDATE actions by using COLUMNS_UPDATED.
This returns a bit pattern that indicates which columns were inserted or updated.
Dict Reader(csvfile)for row in reader:sql = "UPDATE sequence_group_annotation SET STATUS = '" row['status'] "', UPDATED_DATE=CURRENT_DATE where seq_id_pk='" roable2 t2where t1.col1 = t2.col1; SQL Fiddle Demo With that said, no need to update col1 = t2.col1 since that is your join criteria.
| this answer answered Oct 7 '13 at sgeddes 49.1k 4 30 48 Thanks, that helped.
In some databases, such as Postgre SQL, when a FROM clause is present, what essentially happens is that the target table is joined to the tables mentioned in the fromlist, and each output row of the join represents an update operation for the target table.Boolean UPDATE() returns TRUE regardless of whether an INSERT or UPDATE attempt is successful.To test for an INSERT or UPDATE action for more than one column, specify a separate UPDATE() clause following the first one.The returning clause retrieves the rows affected by a DML statement.You can specify this clause for tables and materialized views and for views with a single base table.To properly show you how to use the UPDATE statement I will need to create a few tables to hold some sample data.