在SQL Server中按一栏汇总

编程入门 行业动态 更新时间:2024-10-27 19:27:16
本文介绍了在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中按一栏汇总

本文发布于:2023-10-14 19:04:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1491934.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:SQL   Server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!