Office中国论坛/Access中国论坛

标题: 不同范围的数据个数,如何做查询 [打印本页]

作者: gurenhua    时间: 2009-11-29 21:11
标题: 不同范围的数据个数,如何做查询
新手求教:我有个表,如图。,希望建立个查询,得到为
<0.4   XXX个
>0.4 and <0.45 XXX个
>0.45  xx个的效果,该怎么做啊?

请帮助下,谢谢了!
作者: aslxt    时间: 2009-11-30 12:38
例如:
SELECT 表达式1 AS 数据期间,COUNT(表达式1) AS 数据个数 FROM
(SELECT 表6.时间, 表6.数量, IIf([数量]>=0.9,">=0.9",IIf([数量]>=0.7,">=0.7",IIf([数量]>=0.4,">=0.4",IIf([数量]>=0.2,">=0.2","<0.2")))) AS 表达式1
FROM 表6)
GROUP BY 表达式1 ;
作者: todaynew    时间: 2009-11-30 13:19
select iif(tave<0.4,"<0.4",iif(tave>=0.4 and tave<0.45,">=0.4 and <0.45",">0.45")) as 项目,count(项目) as 计数
from tbname
group by iif(tave<0.4,"<0.4",iif(tave>=0.4 and tave<0.45,">=0.4 and <0.45",">0.45"))




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3