当前位置: 代码迷 >> Sql Server >> 关于字段相加的有关问题
  详细解决方案

关于字段相加的有关问题

热度:83   发布时间:2016-04-27 20:02:48.0
关于字段相加的问题
有一个表
字段为:a1   a2   a3
数据:     a     b    
                c     d        
我现在想写一条插入语句,想让a3=a1+a2

结果应该是:
a1   a2   a3
a     b     ab
c     d     cd  


改怎么写?


------解决方案--------------------
select a1, a2 ,a3 = isnull(a1, ' ') + isnull(a2, ' ') from table
------解决方案--------------------
update 表名 set a3=a1+a2
  相关解决方案