如何计算分组数 [英] How to take count of group by
本文介绍了如何计算分组数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
好友,
我想以小组的数量来计算
>
意味着我显示了一些按房价分组的值
我想要多少房子的数量没有显示。
请帮助我........
提前致谢....
Hi
Friends,
I want to take the count of group by
means i was displayed some values group by house no
I want the count of how much group of house no is displayed.
Please Help me........
Thanks in advance....
推荐答案
尝试从表中选择count(house_no) group by house_no
WITH TempCount(housecount,houseno)
AS
(
select count(house_no),house_no from table group by house_no
)
SELECT houseno,count(housecount) from TEmpCount
您可以将结果查询放在临时表中,例如
选择.....进入#temp
来自
....
group通过....
使用后
从#temp中选择COUNT(不同的HouseNO。)
它适用于你
You can put your resulted query in temp table like
select .....into #temp
from
....
group by....
after that use
select COUNT(distinct HouseNO.) from #temp
It will work for you
这篇关于如何计算分组数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文