sql怎么把一行数据中的几列相加?
1个回答
展开全部
1、创建测试茄哪表袜桥,create table test_num(fee_id number, fee1 number, fee2 number, fee_3 number);
2、插入测试数据,
insert into test_num values(1001, 1200,1800,3000);
insert into test_num values(1002, 2200,6800,4055);
insert into test_num values(1003, 3200,7800,3790);
insert into test_num values(1004, 4200,1400,6800);
insert into test_num values(1005, 5200,1330,7800);
insert into test_num values(1006, 6200,1800,5200);
3、查询表中记录,select * from TEST_NUM t
4、编辑sql,输出颤好码多列相加的结果,select t.*, fee1+fee2+fee_3 as fee_all from TEST_NUM t
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询