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'
UPDATE `table` SET test=number
update tabe2 set subject_id = (SELECT GROUP_CONCAT(sub_id SEPARATOR ', ') as sub_id FROM tabe1)