组的动态行数 [英] Dynamic RowCount of a Group

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

问题描述

-我不知道将形成多少个组,我希望显示每个组的总行数.

-我还希望总静态行数,或以某种方式对每个组的行数求和.

谢谢

...我尝试了Count,CountDistinct和CountRows函数,但由于某些原因,它们总是返回组数,而不返回组中的行.

-I dont know how many groups will be formed and I want the total rowcount of each group to be displayed.

-I also want the total static rowcount, or some way to sum the rowcounts of each group.

Thanks

...I tried the Count, CountDistinct and CountRows functions but for some reason they always return the number of groups but not the rows within a group.

推荐答案

如果您可以发布您正在使用的数据库以及您尝试过的SQL的信息,这会有所帮助,因为我们不知道您的文件结构...但是我猜您想要这样的东西:

SELECT columnYouGroupBy, count(*) FROM table GROUP BY columnYouGroupBy UNION SELECT ''TOTAL'', count(*) FROM table
It would help if you would post what DB you are using and the SQL you tried since we don''t know your file structure...but I''m guessing you want something like this:

SELECT columnYouGroupBy, count(*) FROM table GROUP BY columnYouGroupBy UNION SELECT ''TOTAL'', count(*) FROM table


这篇关于组的动态行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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