This is called a correlated update
UPDATE table1 t1 SET (name, desc) = (SELECT t2.name, t2.desc FROM table2 t2 WHERE t1.id = t2.id) WHERE EXISTS ( SELECT 1 FROM table2 t2 WHERE t1.id = t2.id )
Assuming the join results in a key-preserved view, you could also
UPDATE (SELECT t1.id, t1.name name1, t1.desc desc1, t2.name name2, t2.desc desc2 FROM table1 t1, table2 t2 WHERE t1.id = t2.id) SET name1 = name2, desc1 = desc2
Related Posts:
- ORA-01779: cannot modify a column which maps to a non key-preserved table
- ORA-00904: invalid identifier
- how to fix oracle ORA-01722 invalid number error
- How can I do an UPDATE statement with JOIN in SQL Server?
- ORA-00979 not a group by expression
- ORA-00907: missing right parenthesis
- How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
- ORA-01843 not a valid month- Comparing Dates
- ORA-00918: column ambiguously defined in SELECT *
- Oracle error : ORA-00905: Missing keyword
- How do I limit the number of rows returned by an Oracle query after ordering?
- Oracle SELECT TOP 10 records
- Can a foreign key be NULL and/or duplicate?
- How to Select Top 100 rows in Oracle?
- ORA-12560: TNS:protocol adaptor error
- ORA-00972 identifier is too long alias column name
- Oracle Apex column link from LOV values
- PLS-00103: Encountered the symbol when expecting one of the following:
- What’s the difference between RANK() and DENSE_RANK() functions in oracle?
- ORA-00918: column ambiguously defined in SELECT *
- ORA-00918: column ambiguously defined in SELECT *
- Oracle – ORA-01489: result of string concatenation is too long [duplicate]
- ORA-01861: literal does not match format string
- What is it exactly a BLOB in a DBMS context
- “ORA-01438: value larger than specified precision allowed for this column” when inserting 3
- How do you create a temporary table in an Oracle database?
- Oracle “Partition By” Keyword
- How to insert date values into table
- I want to use CASE statement to update some records in sql server 2005
- SQL selecting rows by most recent date with two unique columns
- ORA-06502: PL/SQL: numeric or value error: character string buffer too small
- MySQL – UPDATE multiple rows with different values in one query
- Comparing Dates in Oracle SQL
- Convert timestamp to date in Oracle SQL
- How do I reset a sequence in Oracle?
- Update statement with inner join on Oracle
- MySQL equivalent of DECODE function in Oracle
- mysql update column with value from another table
- updating table rows in postgres using subquery
- I want to use CASE statement to update some records in sql server 2005
- Oracle: If Table Exists
- DATEDIFF function in Oracle
- How to create id with AUTO_INCREMENT on Oracle?
- LEFT function in Oracle
- What is the difference between Views and Materialized Views in Oracle?
- How do I view the Explain Plan in Oracle Sql developer?
- ORA-01735: invalid ALTER TABLE option – Toad
- Update query using Subquery in Sql Server
- ora-06553 pls-306 wrong number or types of arguments in call to ‘ogc_x’
- What’s the best way to search for a UPC code in a Database?
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between UNION and UNION ALL?
- Selecting COUNT(*) with DISTINCT
- Case in Select Statement
- What is a stored procedure?
- SQL WITH clause example [duplicate]
- Unknown column in ‘field list’ error on MySQL Update query
- Unknown column in ‘field list’ error on MySQL Update query
- SQL Inner-join with 3 tables?
- The wait operation timed out. ASP
- What is SELF JOIN and when would you use it? [duplicate]
- The wait operation timed out. ASP
- Conversion failed when converting date and/or time from character string while inserting datetime
- Self Join to get employee manager name
- How do I UPDATE from a SELECT in SQL Server?
- SQL error “ORA-01722: invalid number”
- SQL query to select dates between two dates
- MySQL – Operand should contain 1 column(s)
- SQL SELECT WHERE field contains words
- Conversion failed when converting date and/or time from character string while inserting datetime
- When should I use CROSS APPLY over INNER JOIN?
- MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050
- Insert Data Into Temp Table with Query
- QL Error: ORA-00933: SQL command not properly ended
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- MySQL create table if not exists and insert record only if table was created
- error, string or binary data would be truncated when trying to insert
- How to create Temp table with SELECT * INTO tempTable FROM CTE Query
- NOT IN vs NOT EXISTS
- SQL SELECT WHERE field contains words
- Online SQL Query Syntax Checker
- Must declare the scalar variable
- How do I use properly CASE..WHEN in MySQL
- Must declare the scalar variable
- Rename column SQL Server 2008
- Why do we need “Relationships” between tables at all?
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Using group by on multiple columns
- Efficiently convert rows to columns in sql server
- Update multiple columns in SQL
- How can I do a FULL OUTER JOIN in MySQL?
- Nested select statement in SQL Server
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Using group by on multiple columns
- SQL SELECT WHERE field contains words
- MySQL query String contains
- How do I escape a single quote in SQL Server?
- What’s the difference between VARCHAR and CHAR?