select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=1
select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=2
select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=3
select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=4
select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number>=5
如何把这5条sql语句变成一条,我要的结果是 =1=2=3=4大于5的用户分别说多少,不是要总数的亲们
sql语句问题求大神帮忙帮忙
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答
- feiyun0112 2014-06-18 07:02关注
select
A=(select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=1)
,B=(select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=2)
,C=(select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=3)
,D=(select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number=4)
,E=(select count(*) from (SELECT HY_GUID,COUNT(*) number FROM dbo.BI_GYDD GROUP BY HY_GUID) a where number>=5)解决 无用评论 打赏 举报
悬赏问题
- ¥15 微信公众号自制会员卡没有收款渠道啊
- ¥15 stable diffusion
- ¥100 Jenkins自动化部署—悬赏100元
- ¥15 关于#python#的问题:求帮写python代码
- ¥20 MATLAB画图图形出现上下震荡的线条
- ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
- ¥15 perl MISA分析p3_in脚本出错
- ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
- ¥15 ubuntu虚拟机打包apk错误
- ¥199 rust编程架构设计的方案 有偿