Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql update table from select on another table

UPDATE TableB 
SET TableB.value = (
    SELECT TableA.value 
    FROM TableA
    WHERE TableA.name = TableB.name
);
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

PREVIOUS NEXT
Code Example
Sql :: get unix time roblox 
Sql :: drop primary key 
Sql :: LoadError: cannot load such file -- mysql2/2.7/mysql2 
Sql :: reset sql auto increment 
Sql :: sql today at midnight 
Sql :: how to find the most occuring in SQL 
Sql :: get last record in sql 
Sql :: how to find date from date table in sql 
Sql :: ilike for date postgres 
Sql :: mysql delete 
Sql :: sql cast to integer 
Sql :: mysql sysdate 
Sql :: mysql update set sum 
Sql :: mysql connection string 
Sql :: grant mysql 
Sql :: script to add datafile to tablespace 
Sql :: sql server convert string to date 
Sql :: org.h2.jdbc.jdbcsqlsyntaxerrorexception table not found 
Sql :: data directory postgresql 
Sql :: tsql random number 
Sql :: sql select between two dates 
Sql :: epoch time converter in snowflake 
Sql :: convert date to datetime sql 
Sql :: grant read only privileges postgres user 
Sql :: list all columns in a table sql 
Sql :: ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails 
Sql :: postgresql search object in array 
Sql :: mysql add to number 
Sql :: how to see the query of a view in mysql 
Sql :: show slave status mysql 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =