查询一个数字怎么处理空值的情况?

bhut 2003-08-21 04:29:38
update table set col=
((select a from tablea)+(select b from tableb))where ……
这里a或b的值都是数字,但是可能有一个为空(不会两个同为空),造成update的结果为空。另外不能拆成几条语句
...全文
42 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
CrazyFor 2003-08-21
  • 打赏
  • 举报
回复
update table set col=
((select isnull(a,0) from tablea)+(select isnull(b,0) from tableb)) where ……
ghtghtmalone 2003-08-21
  • 打赏
  • 举报
回复
可比可以给一个默认值?如0?
update table set col=
((select isnull(a,0) from tablea)+(select isnull(b,0) from tableb))where ……
dafu71 2003-08-21
  • 打赏
  • 举报
回复
update table set col=
((select isnull(a ,0) from tablea)+(select isnull(b,0) from tableb))where ……
CrazyFor 2003-08-21
  • 打赏
  • 举报
回复
update table set col=
((select isnull(a,0) from tablea)+(select isnull(b,0) from tableb)) where ……

34,575

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧