读书人

关于字段相加的有关问题

发布时间: 2012-01-24 23:11:54 作者: rapoo

关于字段相加的问题
有一个表
字段为: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

读书人网 >SQL Server

热点推荐