Search
 
SCRIPT & CODE EXAMPLE
 

SQL

update set with inner join oracle

UPDATE 
(SELECT table1.value as OLD, table2.CODE as NEW
 FROM table1
 INNER JOIN table2
 ON table1.value = table2.DESC
 WHERE table1.UPDATETYPE='blah'
) t
SET t.OLD = t.NEW

or

UPDATE table1 SET table1.value = (SELECT table2.CODE
                                  FROM table2 
                                  WHERE table1.value = table2.DESC)
WHERE table1.UPDATETYPE='blah'
AND EXISTS (SELECT table2.CODE
            FROM table2 
            WHERE table1.value = table2.DESC);
Comment

PREVIOUS NEXT
Code Example
Sql :: woocommerce mysql price table 
Sql :: replace null with 0 in sql 
Sql :: sql query inline if 
Sql :: mysql reset auto increment to 1 
Sql :: psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user 
Sql :: How to View column names of a table in SQL 
Sql :: Oracle NLS_CHARACTERSET 
Sql :: ksql terminate all queries 
Sql :: remove transient options sql wordpress 
Sql :: having vs where 
Sql :: alter table in mysql 
Sql :: mysql round 
Sql :: backup ms sql database table data to file 
Sql :: psql: FATAL: Ident authentication failed for user "postgres" 
Sql :: postgresql restore from dump 
Sql :: oracle create as select 
Sql :: mysql data types 
Sql :: how to change column type psql 
Sql :: sql show tables 
Sql :: sql update all rows 
Sql :: cast to float with .2 sql 
Sql :: mssql how to insert more than 1000 rows 
Sql :: sql remove not null constraint 
Sql :: SQL Modify Column in a Table -Oracle 
Sql :: drop foreign key mysql 
Sql :: mysql sort descending 
Sql :: disable trigger sql oracle 
Sql :: how to fetch first 5 characters in sql 
Sql :: tsql insert 
Sql :: oracle trigger 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =