两列总和 [英] sum of two columns sum
本文介绍了两列总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
我想要下面的SQL查询
Hi Friends,
I want sql query for the below
Hrs1 Hrs2
10 12
8 10
15 7
我想把总和(总和(Hrs1),总和(Hrs2))作为总计
我尝试了上述查询,但会显示错误。请有人帮帮我。
谢谢,
Nandha
I want to take sum(sum(Hrs1),sum(Hrs2)) as Total
I tried the above query but it will shows an error. Please anyone help me.
Thanks,
Nandha
推荐答案
试试sum(Hrs1)+ sum(Hrs2)as Total
Try sum(Hrs1)+sum(Hrs2) as Total
select hrs1 + hrs2 as totalhrs from tableName
OR
--for summary, this will give single row as answer.
select sum(hrs1 + hrs2) as totalhrs from tableName
快乐编码!
:)
Happy Coding!
:)
SELECT (SUM(hrs1)+ SUM(hrs2))作为来自tableName.this的'totalhrs'可以得到
SELECT (SUM(hrs1 )+SUM(hrs2)) as 'totalhrs' from tableName.this can get
这篇关于两列总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文