Languages SQL Transactions  

Update a table with itself, with one SQL statement

download download  
important code information
author:
Andy Archer
minimum requirements:
Update a table with itself, with one SQL statement description

Sometimes you may need to update a table with its own data, typically when rows contain a link to values stored in other rows. The example SQL and narrative illustrate how to do this via an Update statement with a subquery.


File List:
update_table_with_itself.sql7Kb

Similar code
Delete duplicates in a table (using a FOR UPDATE cursor and PL/SQL control) (Popularity: ) : This PL/SQL block deletes duplicate rows in a table, using a FOR UPDATE cursor and program control. Clear, concise comments are interspersed in the code. A test execution is included.
Insert the ampersand (&) via SQL*Plus (Popularity: ) : This short write-up examines the role of the ampersand (&) in SQL*Plus, and shows how you can easily turn it into just another text character when you need to insert it into a table.
Delete duplicates in a table (cleanly and easily, using ROWID) (Popularity: ) : This simple SQL statement deletes duplicate rows in each set, using the pseudocolumn ROWID (row address), preserving the first inserted row of each duplicate set.
User reviews

Write a review:
1 2 3 4 5 6 7 8 9 10
1=poor 10=excellent
Write review*
Your name*
Email*
  (Comments are moderated, and will not appear on this site until the editor has approved them)
 
Rate me
supported os
stats
downloads 14
version
size in Kb 2
popularity   681/7913374
user rating 4/10
ad


New Code
Popular Code