关于DB2中两字段相加
有两列,列A值是1000,列B的值是空白。
怎么可以select A+B from table,最终显示为1000,但是现在显示是空白。
[解决办法]
select A+(case when B is null then 0 else B end) from table
或者
select A+COALESCE(B,0) from table
发布时间: 2014-04-19 16:49:24 作者: rapoo
关于DB2中两字段相加
有两列,列A值是1000,列B的值是空白。
怎么可以select A+B from table,最终显示为1000,但是现在显示是空白。
[解决办法]
select A+(case when B is null then 0 else B end) from table
或者
select A+COALESCE(B,0) from table