1UPDATE t1
2SET t1.COL1 = t2.COL1, t1.COL2 = t2.COL2
3FROM MY_TABLE AS t1
4INNER JOIN MY_OTHER_TABLE AS t2 ON t1.COLID = t2.ID
5WHERE t1.COL3 = 'OK';
1UPDATE table_name SET field1 = 'value 1', field2 = 'value 2'
2WHERE field3 = 'value 3'
3
1-- Set New Employee Password
2UPDATE employee
3SET employee.password = '1234'
4WHERE employee.email = 'emp@gmail.com';
1UPDATE tableName SET anAttribute = 'Something' WHERE anOtherAttribute = 'SomethingElse'
2
3//All 'SomethingElse' values will become 'Something'
1UPDATE tableA a
2INNER JOIN tableB b ON a.name_a = b.name_b
3SET validation_check = if(start_dts > end_dts, 'VALID', '')
4-- where clause can go here
5
1UPDATE
2 `table1` AS `dest`,
3 (
4 SELECT
5 *
6 FROM
7 `table2`
8 WHERE
9 `id` = x
10 ) AS `src`
11SET
12 `dest`.`col1` = `src`.`col1`
13WHERE
14 `dest`.`id` = x
15;
16