1.不加判断,简单方式
update table1 a
left join table2 b on a.table2_id = b.id
set a.table2_remark = b.remark
where a.status != 0
2.加判断
update table1 a
left join table2 b on a.table2_id = b.id
set a.table2_remark = (
case
when b.remark is null then '无'
else
b.remark
end
)
where a.status != 0