Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql update field from one table to another

UPDATE MY_TABLE AS t1
INNER JOIN MY_OTHER_TABLE AS t2 ON t1.COLID = t2.COLID
SET t1.COL1 = t2.COL1, t1.COL2 = t2.COL2
WHERE t1.COL3 = 'OK';
Comment

mysql update table from another table

UPDATE tableB
INNER JOIN tableA ON tableB.name = tableA.name
SET tableB.value = IF(tableA.value > 0, tableA.value, tableB.value)
WHERE tableA.name = 'Joe'
Comment

mysql update column with value from another table

UPDATE tableB
INNER JOIN tableA ON tableB.name = tableA.name
SET tableB.value = IF(tableA.value > 0, tableA.value, tableB.value)
WHERE tableA.name = 'Joe'
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql get first x characters 
Sql :: postgresql change column type 
Sql :: psql connections 
Sql :: find mysql version linux 
Sql :: his is incompatible with sql_mode=only_full_group_by 
Sql :: OSError: mysql_config not found 
Sql :: Found option without preceding group in config file: /etc/mysql/mariadb.conf.d/50-server.cnf at line: 1 
Sql :: search stored procedures by name 
Sql :: oracle find text in functions 
Sql :: sql drop schema 
Sql :: show all sequence in postgresql 
Sql :: mysql where one year ago 
Sql :: oracle check table lock 
Sql :: oracle user last connected 
Sql :: oracle create_program 
Sql :: PLS-00225 type 
Sql :: change mysql password from command line 
Sql :: convert epoch to date in sql server 
Sql :: mysql monthname 
Sql :: how to give user privelege to create dblink in oracle 
Sql :: mysql set field unique 
Sql :: upload database mysql command line 
Sql :: postgresql reset auto_increment index 
Sql :: console output pl sql 
Sql :: oracle synonym 
Sql :: sql remove first character from string 
Sql :: add primary key to existing table sql 
Sql :: mysql add comment to column 
Sql :: get rows affected mysql python 
Sql :: sql update query 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =