如何在sql中找到sum的总和 [英] how to find the sum of sum in sql
本文介绍了如何在sql中找到sum的总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
就好像有这样的查询
从salarydetails(表格)中选择总和(工资)作为'月薪'..
如何找到这样的
总和(总和(工资))为'总薪水'.....
like if a have query like this
select sum(salary) as 'monthly salary' from salarydetails(table)..
how to find like this
the sum(sum(salary)) as 'total salary'.....
推荐答案
试试这个
Try this
With MonthSalCTE
As
(
select sum(salary) as 'monthly salary'
from salarydetails
)
select SUM([monthly salary]) from MonthSalCTE;
这篇关于如何在sql中找到sum的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文