create table Pay
([充值编号] varchar(10),[充值类型] varchar(10),[充值金额] int)
insert into Pay
select '1','微信',5
union all select '2','支付宝',6
union all select '3','微信',3
union all select '4','支付宝',4
表数据:
充值编号 充值类型 金额
1 微信 5
2 支付宝 6
3 微信 3
4 支付宝 4
结果:
微信(充值) 支付宝 (充值) 总金额
9 10 19