update table1 a set a.bal=a.bal+(select b.bal from table2 b where a.no=b.no)
预期的期望是刷数据,但是执行完语句之后,金额(bal)字段被改为 null,希望能够得到指点。 数据库版本为DB2 10.1
收起尝试对b.bat 增加 null值判断,应该是 table2中没有对应的数据.
update table1 a set a.bal=a.bal+(select coalesce(b.bal,0) from table2 b where a.no=b.no)