本文介绍了在SQL Server中按一栏汇总的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友 我希望仅按表的列汇总查询,其余部分应按原样显示. 但是当我按条款在分组中使用它们时,我面临的汇总问题将应用于表的每一列. 有人可以提出解决方案吗?
Hi friends I want ot rollup my query by only column of the table and rest should come as it is. But the problem i am facing the rollup is applied on each column of the table when i am using them in the group by Clause . Can anyone please suggest a solution?
推荐答案检查一下: chiragrdarji.wordpress/2008 /09/09/group-by-cube-rollup-and-sql-server-2005/ [ ^ ] Check this out : chiragrdarji.wordpress/2008/09/09/group-by-cube-rollup-and-sql-server-2005/[^]
您使用的是哪个版本的SQL Server使用吗? 在SQL Server 2008上,您可以使用分区来汇总任何列. Which version of SQL server are you using? On SQL Server 2008 you can rollup any column with partitioning. select sum(aggregation_field) over (partition by GroupingField) ,otherfield2 ,otherfield2 from dbo.table
您可以按其他字段分组,也可以完全不分组. 请注意,这样您将获得< aggregation_field>的总和.在每一行中.
You can group by another field or not group at all. Note that with this you will get the sum of <aggregation_field> in every row.
更多推荐
在SQL Server中按一栏汇总
发布评论