别名列中的值计数 [英] Count of values in alias column

查看:97
本文介绍了别名列中的值计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个SQL表,我在列值上执行一些Count,然后使用ASP.NET的gridview将其显示到前端。 br />
我在SQL查询下面使用

Hello,

I have a SQL table and i am performing some Count on the column values and then displaying it using ASP.NET's gridview to the frontend.
I am using below SQL query

select currentstepname,   
sum(case when bundledtype in ('1','3','5') then 1 else 0 end) Count1,  
sum(case when bundledtype in ('2','4','5') then 1 else 0 end) Count2,  
sum(case when currentstepname in ('Decider','Checker') then 1 else 0 end) Count3,  
count(*) as GrandTotal,
from table1   
where currentstepname in ('EV Bucket','IV Bucket')  
group by currentstepname  






现在我想要的是获取每个Alias列的总和,并将其显示为gridview的最后一行。

我目前在GridView上看到的内容如下。



| CurrentStepName | Count1 | Count2 | Count3 | GrandTotal

决策者-------------- 8 ---------- 0 ------- 0 ------ ------ 8

Checker --------------- 4 --------- 0 ------- 0 ----------- 4

EVBucket -------------- 0 --------- 20 ---- --- 14 ----------- 34

IVBucket -------------- 0 ---------- 10 ------ 5 ----------- 15

TotalCount --------- 12 ------- 30 ----------- 19 ------------ 61





在上面的gridview中,我希望添加粗线(TotalCount)。它计算所有列值的值。

我希望我已经清楚了。



期待您的帮助
非常感谢,



我尝试过:



Searcher谷歌但找不到类似的问题



Now what i want is to get the total sum of each of Alias columns aswell and show it as the final row of the gridview.
What i am currently seeing at the GridView is as follows.

|CurrentStepName | Count1 | Count2 | Count3 | GrandTotal
Decider -------------- 8---------- 0 ------- 0------------ 8
Checker--------------- 4 --------- 0 ------- 0 ----------- 4
EVBucket-------------- 0--------- 20------- 14----------- 34
IVBucket-------------- 0---------- 10------ 5 ----------- 15
TotalCount---------12-------30-----------19------------61


In the above gridview i want the Bold Line (TotalCount) to be added. It counts the value of all the column values.
I hope i have made myself clear.

Looking forward to your help
Thanks a ton,

What I have tried:

Searcher google but could not find a similar problem

推荐答案

如果我理解你,你想显示数据网格的摘要行。如果是这样,请检查:

如何:使用Visual C#.NET在ASP.NET中为DataGrid创建摘要行 [< a href =https://support.microsoft.com/en-us/help/326339/how-to-create-a-summary-row-for-a-datagrid-in-asp.net-by-using- visual-c-.nettarget =_ blanktitle =New Window> ^ ]

教程15:在GridView的页脚中显示摘要信息 [ ^ ]
If i understand you well, you want to display summary row for a datagrid. If so, please check this:
HOW TO: Create a Summary Row for a DataGrid in ASP.NET by Using Visual C# .NET[^]
Tutorial 15: Displaying Summary Information in the GridView's Footer[^]


这篇关于别名列中的值计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆