表末添加一列,用来计算前面各列的总和,SQL语句怎么写

2025-03-24 16:09:36
推荐回答(1个)
回答1:

例如添加列total
alter table 表名
add total int

然后将各列的值刷到total列中
update 表名
set total=列1+列2+列3...
where total is not null