读书人

两字段求和写入第三个字段,该怎么处理

发布时间: 2012-02-20 21:18:24 作者: rapoo

两字段求和写入第三个字段
数据表结构如下:
A B C D E
------------------------
123 25 11 11 null
123 85 21 21 null
456 25 8 8 null

我想将C、D相加并写入E,这样的SQL语句怎么写?

[解决办法]
update 表名 set e=c+d
[解决办法]
update table1 set e=convert(decimal(10,6),c+d) from table2 where table2.Barcode = table1.Barcode and table2.w= '123 '

读书人网 >SQL Server

热点推荐