字段age 的值 从1 到100,按不同年龄组分组.
如:
<10岁
11-60岁
60-90岁
>90岁计算出不同年龄组的人数
如:
<10岁
11-60岁
60-90岁
>90岁计算出不同年龄组的人数
解决方案 »
- 恢复联机日志出错
- 求助:java.sql.SQLException: ORA-00932: inconsistent datatypes: expected %s got %s
- ORA-01756 引号内的字符串没有正确结束
- 菜鸟急等!!请高手回答...
- oracle开发使用pro*c还是odbc?请大家指教
- 主键和唯一键有什么区别?
- 如何在Oracle两个字段中间添加一个字段而不冲掉原来的数据?
- 谁有关于ORACLE的存储过程的电子教程
- - - - - - 如何使非主键字段唯一- - - - - -
- 在OTN上下载的ORACLE ODBC DRIVER FOR MSSQL怎样安装?
- 求一条SQL语句
- oracle9i连到oracle7.13上为什么汉字显示是乱码
select '11-60'age,count(*),sum(... from t where age >= 11 and age< 60 union all
select '60-90'age,count(*),sum(... from t where age between 60 and 90 union all
select '>90' age,count(*),sum(... from t where age >90
select '11-60' age, count(*),sum(...from t where age between 11 and 60 union all
select '60-90' age, count(*),sum(...from t where age between 60 and 90 union all
select '>90' age, count(*), sum(...from t where age >90
from (select (case when (age>= 0 and age<= 10) then '0-10'
when (age>= 3 and age< 7) then '11-20'
..........
else '>90' end) as xx from tab
)
group by xx
from (select (case when (age>= 0 and age<= 10) then '0-10'
when (age>= 11 and age<= 60) then '11-60'
when (age>= 61 and age<= 90) then '60-90'
else '>90' end) as xx from tab
)
group by xx