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 is the difference between UNION and UNION ALL?
- Selecting COUNT(*) with DISTINCT
- Unknown column in ‘field list’ error on MySQL Update query
- How to create Temp table with SELECT * INTO tempTable FROM CTE Query
- Using group by on multiple columns
- Efficiently convert rows to columns in sql server
- Update multiple columns in SQL
- Nested select statement in SQL Server
- What’s the difference between VARCHAR and CHAR?
- How to split the name string in mysql?
- Sql Server equivalent of a COUNTIF aggregate function
- Column name or number of supplied values does not match table definition
- Simple PHP Pagination script
- Warning: Null value is eliminated by an aggregate or other SET operation in Aqua Data Studio
- SQL – HAVING vs. WHERE
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
- How to SUM two fields within an SQL query
- DateTime2 vs DateTime in SQL Server
- Difference between numeric, float and decimal in SQL Server
- ERROR: there is no unique constraint matching given keys for referenced table “bar”
- How do I query for all dates greater than a certain date in SQL Server?
- Error converting data type varchar to float
- How to concatenate text from multiple rows into a single text string in SQL Server
- Count(*) vs Count(1) – SQL Server
- Remove duplicate rows in MySQL
- “You tried to execute a query that does not include the specified aggregate function”
- How to write a SQL DELETE statement with a SELECT statement in the WHERE clause?
- How to round down to nearest integer in MySQL?
- MySQL error: key specification without a key length
- SQL: Two select statements in one query
- How to query MongoDB with “like”
- Check if MySQL table exists without using “select from” syntax?
- ‘NOT LIKE’ in an SQL query
- SQL Server dynamic PIVOT query?
- What does Include() do in LINQ?
- SQL Server “cannot perform an aggregate function on an expression containing an aggregate or a subquery”, but Sybase can
- Get everything after and before certain character in SQL Server
- Cannot create an instance of OLE DB provider Microsoft.Jet.OLEDB.4.0 for linked server null
- SUM OVER PARTITION BY
- SQLite string contains other string query
- Cannot insert explicit value for identity column in table ‘table’ when IDENTITY_INSERT is set to OFF
- WordPress SQL LIKE request doesn’t work for fields with special symbols
- Better way to migrate to server?
- WooCommerce database query : Get product category image path+name from thumbnail_id [closed]
- WordPress can I manually add columns in users table and display it in the default manage user plugin and registration form? [closed]
- Help me SELECT thumbnail from SQL and use
- Why is my insert row only inserting the final row from the loop into the database rather than just inserting one
- Search results sort order failing: set by date only
- Creating a “forum” – showing last post or last commented post
- Replace Unwanted Space in Post Content URL
- How to write inner join using posts_clauses?