update a , b set a.content = b.content where a.name = b.name;

使用该sql语句,对比a,b两表,将a表中的content内容修改为b表中的,但是执行后a表中不需要修改的变为了null,请问该怎么修改sql语句?

你语句的意思是:把a、b两个表的name名称相同a的content的值赋给b表的content。
如果你有值的不想修改添加条件就可以了


update a , b set a.content = b.content where a.name = b.name and b.content is not null;